Try OpenEdge Now
skip to main content
Messaging and ESB
Implementing Messaging : Transaction and recovery procedures : Message acknowledgement, forwarding, and recovery : Example
 
Example
Consider the following scenario:
1. A client retrieves a message from a broker's queue.
2. The broker wants to be notified when the message reaches its ultimate destination.
3. The ultimate destination is a remote queue.
4. The client sends the message on its way.
To acknowledge receipt of a message whose ultimate destination is a remote queue, you might enclose the message and acknowledgement in a single transaction; but this introduces the overhead and complexity of transaction processing. SonicMQ provides a cleaner solution, embodied in the following steps:
1. Run the setSingleMessageAcknowledgement procedure to set the session to SINGLE_MESSAGE_ACKNOWLEDGE.
2. Run the acknowledgeAndForward procedure within the message event handler, specifying a destination queue name, the original message handle, and optional message-delivery properties (priority, time to live, and persistency). If the method is successful, the message is acknowledged and forwarded in a single atomic operation.