June 2018
Intermediate to advanced
596 pages
12h 39m
English
Let's create the CourseQueueReceiver class in the packt.jee.eclipse.jms package with the following content:
public class CourseQueueReceiver {
private QueueConnection connection;
private QueueSession session;
private Queue queue;
private String receiverName;
public CourseQueueReceiver(String name) throws Exception{
//save receiver name
this.receiverName = name;
//look up JMS connection factory
InitialContext initCtx = new InitialContext();
QueueConnectionFactory connectionFactory = (QueueConnectionFactory)initCtx.lookup("jms/CourseManagemenCF"); //create JMS connection connection = connectionFactory.createQueueConnection(); connection.start(); //create JMS session session = connection.createQueueSession(false, ...