You should also know to create a JMS Session and QueueSender. It adds the following imports:
import javax.jms.QueueSession;
import javax.jms.Queue;
import javax.jms.QueueSender;
Then:
QueueSession session;
Queue queue;
QueueSender sender;
Code:
try {
session = connection.createQueueSession(true, 0);
queue = (javax.jms.Queue)context.lookup(JNDI_PREFIX + QUEUE);
sender = session.createSender(queue);
}
catch (javax.naming.NamingException ne) {
ne.printStackTrace();
}
catch (javax.jms.JMSException jms) {
jms.printStackTrace();
}
Bookmarks