dcsimg

How does a consumer acknowledge a message from a producer?

Jerry Smith

The easiest way is to allow the framework to do it--automatic acknowledgment:

  ...
  topicCon.createTopicSession(false, AUTO_ACKNOWLEDGE);
  ...

With client acknowledgment, a client can allow messages to accumulate until some arbitrary application condition:

  ...
  topicCon.createTopicSession(false, CLIENT_ACKNOWLEDGE);
  ...

When a client acknowledges a message, the acknowledged message and all "older" messages become unavailable for future processing.