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. lookup("jms/CourseManagemenCF"); connection = connectionFactory.createQueueConnection(); connection.start(); session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); queue = (Queue)initCtx.lookup("jms/courseManagementQueue"); ...