Example: Publishing simple message bodies
A simple message body has a specific structure.
About this task
Field | Type | Value |
---|---|---|
name | (String) | Peter Thompson |
age | (Integer) | 42 |
position | (String) | CEO |
otherData | (Message) | |
libraryCardNo | (Integer) | 765432463 |
creditRating | (Integer) | 0 |
carRegistration | (String) | A227 TWR |
Procedure
- Create a publisher, as described in Test actions. Select a transport and formatter that allow the creation of arbitrary messages (for example, TIBCO Rendezvous). If you choose a JMS topic or Queue, as a simple example, select XML String as the formatter. The XML message editor is covered in Editing XML message structures.
- Right click the root message node (RV Message, in this example) and select Add Child < (String), and the Field Editor appears. In the Name field, enter "name." In the value editor (the empty field below the description), enter "Peter Thompson".
- Click OK when finished and the structure of the message appears as follows:
- Add two more child elements in the same way, one of type Integer and one of type String. For the Integer chile, enter "age" as the name and "42" as the value. For the String element, enter "position" as the name and "CEO" as the value.
- Add the otherData element,
a subtree that consists of two Integer fields and a String, which
can be achieved by using the type Message. Add a child of type Message
(RV Message, in this case). In the field editor, enter "otherData"
in the name field. The message structure now appears as follows:
Since the otherData element is of type Message, the Add Child option is enabled in its menu. Add the following three child elements to otherData:
- libraryCardNo, an Integer with a value of 765432463
- creditRating, an Integer with a value of 0
- carRegistration, a String with a value of A227
TWR
The message structure is now complete and can be published, saved, and so on