/* Create a session on top of the connection which will be used only for
sending messages, transacted and with auto-acknowledge-mode*/
s_send = qc.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
/* Create a session on top of the connection which will be used only for
receiving messages, transacted and with auto-acknowledge-mode */
s_rec = qc.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
/* start the connection */
qc.start();
/* Create a receiver and set a message-listener. This will be used to see,
whether messages are delivered before the session is commited */
QueueReceiver qr = s_rec.createReceiver(q);