Creating Message Segments
This section provides an overview of creating message segments and message segment numbers and discusses how to:
-
Create message segments.
-
Count the number of segments in messages.
-
Store message segments awaiting processing.
-
Override where to store message segment awaiting processing.
-
Specify the order in which to process message segments.
-
Chunk asynchronous segmented messages.
Understanding Creating Message Segments
By default every message has one segment.
To create multiple message segments use the CreateNextSegment method in the location in the message where you want one segment to end and next segment to begin. Continue this process until you have created the desired number of segments for the message.
Segments can contain any number of rowsets of data (rowset-based messages) or rows of data (nonrowset-based messages).
Understanding Message Segment Numbers
When you create a message segment, PeopleSoft Integration Broker assigns a message segment number to the segment.
The first message segment has a message segment number or 1, and message segment numbers are increment by one sequentially thereafter. As an example, if you break a message into three segments, the first segment number is 1, the second segment number is 2, and the third segment number is 3.
Creating Message Segments
The following example shows using the CreateNextSegment method to create three segments in the message QE_FLIGHTPLAN, populating each segment with data from the component buffer.
&MSG = CreateMessage(OPERATION.QE_FLIGHTPLAN);
&rs=&MSG.GetRowset();
//Now populate rowset
// End of first segment. Beginning of second segment.
&MSG.CreateNextSegment();
&rs=&MSG.GetRowset();
//Now populate rowset
//End of second segment. Beginning of third segment.
&MSG.CreateNextSegment();
&rs=&MSG.GetRowset();
//Now populate rowset
%IntBroker.Publish(&MSG);
Counting the Number of Segments in Messages
You might have the need to determine the number of segments in a message. Use the SegmentCount property to determine this information.
Storing Message Segments Awaiting Processing
By default, message segments awaiting processing are stored in memory until all segments are processed. Once all segments are processed, PeopleSoft Integration Broker sends all data as one message.
Use the MessageSegmentFromDB parameter in PSAdmin to specify the number of segments to keep in memory before writing segmented messages to the database. The default value is 10.
For synchronous messages, if the number of segments sent for processing exceeds the set for the MessageSegmentsFromDB parameter, an error occurs.
Overriding Where to Store Message Segments Awaiting Processing
You can override the number of segments to keep in memory before writing segmented messages to the database for a single message using the SegmentsByDatabase property of the Message class.
| Storage Location | Description |
|---|---|
|
Memory |
When message segments are stored in memory, PeopleSoft Integration Broker writes all segments as one message to the database when you send the message. To store message segment data in memory, set the SegmentsByDatabase property to False. (Default.) |
|
Application database |
When message segments are stored in the database, PeopleSoft Integration Broker writes the segments to the database individually. When you store message segments in the database you can have an infinite number of segments in a message. To store message segment data in the application database, set the SegmentsByDatabase property to True. |
When you store message segments in memory, the number of segments is limited by the value set in the MessageSegmentFromDB parameter in PSAdmin in the Setting for PUB/SUB servers section of the file.
When working with asynchronous messages, if you create more message segments then the value set, all segments are written to the database automatically and the SegmentsByDatabase property will automatically be set to True.
For synchronous messages, attempting to create more segments then the specified value will result in an error message.
Specifying the Order in Which to Process Message Segments
When you work with segmented asynchronous messages you can specify that PeopleSoft Integration Broker process the segments in order or unordered, using the SegmentsUnOrder property of the Message class.
| Message Segment Processing | Description |
|---|---|
|
In order |
When Integration Broker processes message segments in order, it decompresses all message segments sequentially and then processes the message as a whole. In this situation, only one publication or subscription contract is created. To process message segment in order, set the SegmentsUnOrder property to False. |
|
Unordered |
When Integration Broker processes message segments unordered, it decompresses and processes all segments in parallel. In this situation, the system creates one publication or subscription contract for each message segment. To process message segment unordered, set the SegmentsUnOrder property to True. |
If you attempt to send ordered segmented messages to a node that is not segment aware an error message will be created and can be viewed on the Message Errors tab on the Message Details page in Service Operations Monitor.
See the product documentation for Integration Broker Service Operations Monitor.
Chunking Asynchronous Segmented Messages
Chunking asynchronous segmented messages sends message in blocks to the receiving node.
When using chunking, message instances display in Hold status in the Service Operations Monitor until all chunks are received. Once all chunks are received, the message status switches to New.
Note:
Chunking applies to ordered asynchronous messages only.
The number of segments to chunk for an asynchronous message is determined by the value you set for the MessageSegmentByDatabase parameter in PSAdmin. The default value is 10.
As an example, if a message has 20 segments and you set MessageSegmentByDatabase to 5, PeopleSoft Integration Broker will send four groups (array of messages) of segments to the integration gateway, and each group will contain five segments.