Sending, Receiving, and Correlating Multiple Segmented Messages

Previous sections in this topic have discussed sending one message that contains multiple message segments. For very large messages this can have performance impact due to the large number of segments.

PeopleSoft provides PeopleCode that allows you to send multiple messages with multiple segments and then correlate them into one transaction on the receiving system. So instead of sending one message with 50 message segments, you can send 10 messages with 5 message segments using parallel processing, and then correlate the 10 messages on the receiving system.

The InitializeConversationId property on the Message object, provides the correlation between messages. The FirstCorrelation method on the Message object ensures that the database table is truncated after receipt of the first message only.

On the first message to be published set the InitializeConversationId property to True. After the message is published retrieve the transaction ID from the message. For all subsequent messages, set the CorrelationID property to the value of the transaction ID returned from the first message. As a result, when the messages arrive at the receiving system they have different transaction IDs, but all have the same correlation ID.

On the receiving system when the first message is received the database table is truncated. To prevent a destructive load from occurring with the receipt and processing of each subsequent message, use the PreNotify event. You can use the PreNotify event to truncate the database table upon receipt of the first message. In subsequent messages use the FirstCorrelation method in the event, setting the method to True, to determine if a prior message with the same correlation ID has already run the event.

The following example shows an example of how the sending system uses the InitializeConversationId property:

/*First Message to Publish */
&MSG. InitializeConversationId = true;
%IntBroker.Publish(&MSG);
&strCorrelationID  =  &MSG.TransactionId;

/* all subsequent message to correlate*/

&MSG. IBInfo.ConversationID = &strCorrelationID;
%IntBroker.Publish(&MSG);

The following example shows an example of how the receiving system uses the FirstCorrelation method in the PreNotify event:

PreNotify Event:

If &MSG.FirstCorrelation() = true Then
/* process the event logic */

End-If;   

Accessing message segments is described elsewhere in this section.

See Accessing Segments in Messages.