Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
boolean namedSucceeded = true;
try
{
MessageProducer prod = sess.createProducer(dest);
Message m = sess.createTextMessage("Kippers");
prod.send(m);
}
catch (JMSSecurityException e)
{
log.trace("Can't write to destination using named producer");
namedSucceeded = false;
}
boolean anonSucceeded = true;
try
{
MessageProducer producerAnon = sess.createProducer(null);
Message m = sess.createTextMessage("Kippers");
producerAnon.send(dest, m);
}
catch (JMSSecurityException e)
{
log.trace("Can't write to destination using named producer");
anonSucceeded = false;