Release 10.1A: OpenEdge Development:
AppBuilder

> ## The message-handling relationship: internal details

> The process for handling a message is very much the same regardless of whether the message is coming in or going out.

> ##### Outbound message and reply-handling process

> Sending a message requires cooperation between the SmartProducer and an object serving as the `OUTMESSAGE-SOURCE` (OMS). Generally you would use either a SmartB2BObject or a SmartSender as OMS. Figure 6–10 illustrates the process.

> Figure 6–10: Outbound message-handling process

> The steps below describe the process.

> 1. When a message is to be sent, the OMS calls `sendMessage` in the SmartProducer.

> 2. The `sendMessage()` routine in the SmartProducer creates an empty message. It then calls `sendHandler()` in the OMS, passing the handle of the message it created.

> 3. The `sendHandler()` routine in the OMS sets the message header properties, adds a body to the message, and returns.

> 4. The `sendMessage()` routine in the SmartProducer now has a complete message to send and calls the relevant routines in the 4GL-JMS API to start the message on its way.

> 5. When a reply comes in, `replyHandler()` in the SmartProducer calls `replyHandler()` in the OMS, passing it the handle of the reply.

> 6. The `replyHandler()` routine in the OMS gets the ID of the original message and the reply properties and body. It performs any desired processing on that information and returns.

> ##### Inbound message-handling and reply process

> Receiving a message requires cooperation between the SmartConsumer and an object serving as the `INMESSAGE-TARGET` `(IMT)`. Generally you would use either a SmartB2BObject or a SmartReceiver as IMT. Figure 6–11 illustrates this process.

> Figure 6–11: Inbound message-handling process

> If you use a SmartRouter to distribute incoming messages, the SmartRouter acts as an IMT proxy, accepting calls from the SmartConsumer and passing them on transparently to the real IMT. The brief description below ignores the role of the SmartRouter:

> 1. When a message is received, the `messageHandler()` routine in the SmartConsumer calls the `receiveHandler()` routine in the IMT, passing the handle of the received message.

> 2. The `receiveHandler()` routine in the IMT extracts header properties and the message body, performs any desired processing, and returns.

> 3. If the message requires a reply, the `messageHandler()` routine in the SmartConsumer creates an empty reply message and calls `sendReplyHandler()` in the IMT, passing the handle of the reply it created.

> 4. The `sendReplyHandler()` routine in the IMT sets the header properties, adds a body, and returns.

> 5. The `messageHandler()` routine in the SmartConsumer now has a complete reply message to send and calls the relevant routines in the 4GL-JMS API to start it on its way.

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