A client can create multiple sessions within a connection to the broker, each independently sending and receiving messages. Sessions execute in parallel meaning that multiple threads are active concurrently, thereby optimizing throughput. The following illustration shows a client application where one connection is created, and then one session is created.
In creating a session, you specify whether the session is transacted or non
transacted. If a session is transacted, batch
acknowledgement is sent when the commit() method is called. When
a session is non transacted, you set the acknowledgement mode.
Transaction processing significantly reduces the effort required to build applications by allowing applications to combine a group of one or more messages into a logical unit.
When a transaction commits , the message producer sends all the messages since the last transaction and the message consumer acknowledges the messages it received. If a transaction rolls back, the message producer drops any produced messages for the transaction and, for PTP, messages received by the consumer in the scope of the transaction are automatically recovered into their queues.
When an application creates a non transacted session, the acknowledgement mode is set. The acknowledgement mode options are:
AUTO_ACKNOWLEDGE — The client application session acknowledges receipt of a message when the session has successfully returned from a call to
receive, or when theMessageListener(called to process messages) successfully returns a message to the client application.CLIENT_ACKNOWLEDGE — The client application calls a message’s
acknowledgemethod to acknowledge to the broker that all messages are not yet acknowledged.DUPS_OK_ACKNOWLEDGE — When the client session acknowledges the delivery of messages to consumers, the broker does not confirm the acknowledgement.
SINGLE_MESSAGE_ACKNOWLEDGE — The client session explicitly acknowledges one specific message.
While acknowledgement sets standards for message delivery, there is no reply to the producer. The acknowledgment is always sent to, and consumed by, the broker.









