Implementing JMS queue sender class

Let's create the CourseQueueSender class in the packt.jee.eclipse.jms package with the following content:

package packt.jee.eclipse.jms; 
//skipped imports 
public class CourseQueueSender { 
  private QueueConnection connection; 
  private QueueSession session; 
  private Queue queue; 
  public CourseQueueSender() throws Exception { 
    //Create JMS Connection, session, and queue objects 
    InitialContext initCtx = new InitialContext(); 
    QueueConnectionFactory connectionFactory =      (QueueConnectionFactory)initCtx. 
    connection = connectionFactory.createQueueConnection(); 
    session = connection.createQueueSession(false,  Session.AUTO_ACKNOWLEDGE); queue = (Queue)initCtx.lookup("jms/courseManagementQueue"); ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.