Try OpenEdge Now
skip to main content
Messaging and ESB
Implementing Messaging : Working with messages : Creating, populating, and accessing messages : TextMessage
A TextMessage is a message type whose body contains text data.
The following table lists the methods for handling text messages.
Table 20. Methods for handling text messages
Create method
Populate method
Access method
For any TextMessage smaller than 32K, text data can be extracted and stored in a message by the getText function and the setText procedure method. For a TextMessage longer than 32K, the setLongText procedure and the getLongText function are available. Use of these calls is recommended for new code developed to process large character strings.
Note: You can continue to use the appendText procedure and the getTextSegment function provided in earlier versions of the OpenEdge Adapter for SonicMQ, when ABL imposed a 32K character limit on text strings. However, programming with these older calls is significantly more complex than using the newer setLongText procedure and the getLongText function.
The appendText procedure and the getTextSegment function concatenate text segments. With multiple appendText procedure calls, an OpenEdge client can create a TextMessage up to the limit of the JMS server. The JMS non-OpenEdge client receives a single TextMessage resulting from the concatenation of all the text segments.
The OpenEdge Adapter for SonicMQ divides the received TextMessage into text segments of 8K (8192) or fewer characters. An application can then use multiple getTextSegment function calls to retrieve these segments. If getText function is called instead, the ABL–JMS API returns all of the text, and a run-time error occurs if the TextMessage is too large for the ABL interpreter to handle. An application can use the getCharCount function call to determine the total number of characters in a message.
For example, if the message value is UNKNOWN, or "", or a String of 5,000 characters, an application can use one getText function call (or one getTextSegment function call). If the message size is 16,400 characters, the first two getTextSegment function calls return 8192 characters each, and the last getTextSegment function call returns 16 characters.
The endOfStream function function returns true when all of the segments are retrieved (that is, when the number of getTextSegment function calls matches the number of segments). The setText procedure call implicitly calls clearBody procedure before setting the new text. The reset procedure and getText function calls transfer the message from write-only to read-only mode and position the message cursor before the first segment.
For more information, see Read-only and write-only modes.
Note: The 8K segment size is guaranteed. An OpenEdge application need not use the endOfStream function for messages smaller than 8K, since there is only one segment. For information about code page conversions and text size limits, see XML code page encoding.