Once a connection is made, use the createQueueSession method on the QueueConnection to obtain a session.
The method takes two parameters:
The simplest case is that of the "non-transacted" session with AUTO_ACKNOWLEDGE, as shown in the following code fragment:
QueueSession session;
boolean transacted = false;
session = connection.createQueueSession(transacted,
Session.AUTO_ACKNOWLEDGE);