private void sendReply(String msg, int msgID, long elapsed, Queue dest)
throws JMSException
{
QueueSession qs = null;
QueueSender sender = null;
try
{
qs = qc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
sender = qs.createSender(dest);
TextMessage reply = qs.createTextMessage();
reply.setText(msg + " : " + msgID);
reply.setIntProperty("UNIQUE_ID", msgID);
reply.setLongProperty("Elapsed", elapsed);
sender.send(reply, DeliveryMode.NON_PERSISTENT, Message.DEFAULT_PRIORITY, 180000);
log.info("Message sent");
}
finally
{
if (sender != null)
{
try
{
sender.close();
log.info("QueueSender Closed");
}
catch (JMSException e)
{
log.error("Failed to close queue sender", e);