Once a connection has been created, you can use the
createQueueSession() method
on the QueueConnection to obtain a session. The method takes two parameters:
- A boolean that determines whether the session is "transacted" or "non-transacted".
- A parameter that determines the "acknowledge" mode. This is used when
the session is "non-transacted".
The simplest case is that where acknowledgements are used and are handled
by JMS itself with
AUTO_ACKNOWLEDGE, as shown in the following
code fragment:
QueueSession session;
boolean transacted = false;
session = connection.createQueueSession(transacted, Session.AUTO_ACKNOWLEDGE);