Progress
External Program
Interfaces


Receiving Messages From a Queue

In the PTP domain, applications receive messages from a queue.

To receive messages from a queue with Java–JMS, an application obtains a handle to a queue object, creates a message receiver object, and installs a message-handling routine in the message receiver object.

With the 4GL–JMS API, the general steps to receive messages from a queue are similar, except:

  1. The application implements a message-handler routine to handle the incoming messages.
  2. The application creates a messageConsumer object that contains the message handler and provides context to the application when it processes the messages.
Creating a Message-handler Routine

A message-handler routine must implement a specific signature with two input parameters (the incoming message and the containing messageConsumer object) and one output parameter (for the reply message). For information about the signature of a message handler, see the "Message Handler" section in this chapter.

Creating a Message Consumer

The application creates a messageConsumer object by calling createMessageConsumer in the Session object. The input to createMessageConsumer is the handle and the name of the message handler.

In addition, the application can set more context information in the messageConsumer object. For example, the setApplicationContext procedure in messageConsumer is used by the 4GL application to set a handle (typically a procedure handle) that can be used by the message handler (which calls getApplicationContext) to receive context information and to communicate message processing results to the rest of the application.

Receiving Messages From the Queue

Next, the application calls the receiveFromQueue procedure in ptpsession.p with the queue name and a handle to the messageConsumer object. The application can pass a JMS properties selector expression to the receiveFromQueue call to specify which messages the receiver wants to receive from the queue.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095