Try OpenEdge Now
skip to main content
Messaging and ESB
Implementing Messaging : Consuming messages : Creating a Message Consumer object

Creating a Message Consumer object

The OpenEdge application uses a Message Consumer object to receive messages from a destination or to receive asynchronous error messages. In a Session object, the application creates a Message Consumer object using the createMessageConsumer procedure .
The life cycle of a Message Consumer object includes these general steps:
1. An application implements a procedure to handle the messages.
2. The application creates the Message Consumer, specifying the message-handling procedure.
3. The application uses the Message Consumer object to do one of the following: subscribe to a topic (Pub/Sub) or receive messages from the queue (PTP); set an error handler and receive error messages asynchronously from SonicMQ through the OpenEdge Adapter for SonicMQ; or receive replies in a request/reply cycle.
4. After using the Message Consumer object, the application can activate it by getting into a WAIT FOR state (or any IO-blocking state where the application processes events).
5. When the Message Consumer finishes processing all messages of interest, the application calls the deleteConsumer procedure to release the resources in the OpenEdge application, the OpenEdge Adapter for SonicMQ, and the SonicMQ Broker.