Progress
External Program
Interfaces


4GL–JMS Object Model

The 4GL–JMS object model is a model wherein a 4GL application interacts with a JMS messaging broker through 4GL persistent procedures that encapsulate the functionality of JMS sessions and JMS messages. The 4GL application interacts with the SonicMQ broker through internal procedures, which perform actions, and user-defined function calls to extract values. Asynchronous message arrival is handled by setting up 4GL message handling procedures. A message handler is a routine consisting of a procedure-handle, internal-procedure-name pair, written by the application and set in the Message Consumer object. When a message is received, the message handler is called automatically so the application can process the message.

The following sections describe Session, Message Consumer, and Message objects, how they correspond to 4GL procedures, and how to create them.

Session Objects

Progress supplies two session procedures, jms/pubsubsession.p and jms/ptpsession.p, for the 4GL application to interact with JMS. These procedures run persistently to represent a JMS session and its underlying connection:

These session procedures implement internal procedures that return additional 4GL objects in the form of 4GL persistent procedure handles. A single 4GL session can have any number of jms/pubsubsession.p and jms/ptpsession.p procedures, each of which creates an underlying JMS connection.

Since the Pub/Sub and the PTP models use the same kind of messages and generally support similar strategies for message delivery, acknowledgment, and recovery, the jms/pubsubsession.p and jms/ptpsession.p procedures have similar methods. (For more information, see the "Connections and Sessions" section in this chapter.)

Message Consumer Object

A Message Consumer is a JMS messaging object that receives messages from a destination or receives asynchronous error messages. The jms/pubsubsession.p and jms/ptpsession.p procedures create the messageConsumer object to handle incoming messages (using the createMessageConsumer internal procedure). The 4GL application must set a message handler procedure in the messageConsumer object by implementing a 4GL internal procedure with a specific signature. To create the messageConsumer object, the application passes the name of that internal procedure, as well as a handle to the persistent procedure instance that defines that procedure, to the Message Consumer object. (For more information on the Message Consumer object, see the "Message Consumer Objects," "Subscribing To a Topic," and "Receiving Messages From a Queue" sections in this chapter.)

The SonicMQ Adapter integrates with 4GL event handling. Messages are processed by the message consumer when the 4GL is in a WAIT–FOR state or other IO blocking states. While in a WAIT–FOR or other IO blocking state, all other UI and non-UI events are handled normally. WAIT–FOR can be called explicitly or through the waitForMessages Session object method, which works the same for GUI, character, batch, AppServer, and WebSpeed applications.

SonicMQ provides several standard JMS message types, plus the XMLMessage type. Table 13–1 lists the JMS message types, the corresponding SonicMQ message types, and the Session object internal procedure that create those messages.

Table 13–1: Message Types 
JMS Message Type
SonicMQ Message Type
Session Object Internal Procedure
TextMessage
TextMessage
createTextMessage
MapMessage
MapMessage
createMapMessage
StreamMessage
StreamMessage
createStreamMessage
BytesMessage
BytesMessage
createBytesMessage
ObjectMessage
ObjectMessage
Not supported by the 4GL–JMS API
Message
Message
createHeaderMessage
Not supported by JMS
MultiPartMessage
createMultipartMessage
Not supported by JMS
XMLMessage
createXMLMessage

NOTES:


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