This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

A subscriber client receiving messages from a queue or topic in the broker should be configured to send an acknowledgement back to the broker when the messages are received. There are several acknowledgement methods that can be used by the subscriber.


Configuring the time taken to acknowledge messages 

There are several acknowledgement models defined in JMS specification 1.1. To configure the time within which consumers can acknowledge messages, you can set the AndesAckWaitTimeOut entry in the JMS client as follows: 

System.setProperty("AndesAckWaitTimeOut", "30000");

If the acknowledgement fails within the above time, the client informs the MB server that the message is rejected. The message is then scheduled to be redelivered later by the server. 

Configuring standard JMS message acknowledgement patterns

The following are acknowledgement patterns introduced by JMS:

  • Auto Acknowledge 
  • Duplicates Allowed
  • Client Acknowledge
  • Transacted Acknowledgement

Configuring per-message acknowledgement

With Per Message Acknowledge we can acknowledge each message as per requirement. Any message that is not acknowledged will go through the same process as when client acknowledged such as the message getting rejected.

Following is a sequence diagram on how an example scenario will work:

 Screen Shot 2016-07-21 at 12.00.00 PM.png

Use the enum org.wso2.andes.jms.Session.PER_MESSAGE_ACKNOWLEDGE available in the andes-client jar or the value 259 when creating the session.

import org.wso2.andes.jms.Session;
QueueSession queueSession = queueConnection.createQueueSession(false, Session.PER_MESSAGE_ACKNOWLEDGE);

or,

QueueSession queueSession = queueConnection.createQueueSession(false, 259);
  • No labels