Implementing JMS queue receiver class

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, ...

Get Java EE 8 Development with Eclipse now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.