About the Pager samples

The Pager samples, Text Messenger and SurfWatch, demonstrate how to use different messaging styles to send messages to a pager application. The Text Messenger sample demonstrates point-to-point messaging, in which the sender application knows the destination of the message; the SurfWatch sample demonstrates publish/subscribe messaging, in which the sender and receiver applications are decoupled from each other. The publish/subscribe style of messaging is similar to posting a message on a notice board; the person who posts the message does not necessarily know who is going to read the message, and the people reading the message do not necessarily know who posted it on the notice board.

This topic describes the message flows and message sets that the Pager samples use to process the messages that are sent to the Pager application. For more information, see Message flows overview, Message modeling, and MQInput node in the IBM Integration Bus documentation.

The Text Messenger sample (point-to-point messaging)

When you use the Text Messenger application to send a message to the Pager sample, the message is processed by the TextMessenger message flow. The message flow appends the text Powered by IBM to the end of the message text, then passes the message to the Pager application.

The TextMessenger message flow

The following figure shows the TextMessenger message flow.

A screen capture of the TextMessenger message flow

The following table lists the types of nodes that are used in the TextMessenger message flow.

Node type Node name
MQInput TEXTMESSENGER
Mapping Mapping
MQOutput TEXTMESSENGER_FAIL; PAGER

The TextMessenger message flow performs the following actions:

  1. When a message is put on the TEXTMESSENGER queue by the Text Messenger application, the TEXTMESSENGER node gets the message from the queue.
  2. The TEXTMESSENGER node refers to information in the message set, where the structure of the message is defined, to verify that the message has the correct structure. If the message has the correct structure, the TEXTMESSENGER node passes the message, through the Out terminal, to the Mapping node. Alternatively, if there is a problem identifying the message, the TEXTMESSENGER node passes the message, through the Failure terminal, to the TEXTMESSENGER_FAIL node, which puts the message on the TEXTMESSENGER_FAIL queue.
  3. The Mapping node transforms the message by appending the words Powered by IBM to the message text. The Mapping node refers to the message set to understand, or parse, the structure of the message.
  4. The PAGER node puts the modified message on the PAGER queue. The Pager application then gets the message from the PAGER queue.

The Pager message definition

When the Text Messenger message flow appends the text to the message, it has to understand the structure of the message. The structure of the message is defined in an external message set, to which the message flow refers. Without this message definition, more complicated nodes in the message flow, such as the Mapping node, would not be able to process the incoming information; the Mapping node has to refer to information in the message definition to process the message.

When you use the Text Messenger application to send a message that reads, for example, This is my message to the pager., the message that enters the message flow looks like the following message:

<pager>
<text>This is my message to the pager.</text>
</pager>

The Mapping node, changes the message by appending the text Powered by IBM to the end of the message text. When the message leaves the message flow, it looks like the following message:

<pager> 
<text>This is my message to the pager. Powered by IBM.</text>
</pager>

The SurfWatch sample (publish/subscribe messaging)

When the Surf Report Publisher application publishes messages, the messages are processed by the SurfWatch message flow. The SurfWatch message flow transforms the surf report messages into plain pager messages, and publishes each message to a topic corresponding to the name of the beach. Messages on the topics to which you have subscribed by using the Surf Report Publisher application are received by the Pager application. For more information, see Publish/subscribe in the IBM Integration Bus documentation.

The SurfWatch message flow

The following diagram shows the SurfWatch message flow.

A screen capture of the SurfWatch message flow

The following table lists the types of nodes that are used in the SurfWatch message flow.

Node type Node name
MQInput SURFWATCH
Mapping Mapping
MQOutput SURFWATCH_FAIL
Publication Publish Reports

The SurfWatch message flow performs the following actions:

  1. When a message is put on the SURFWATCH queue by the Surf Report Publisher application, the SURFWATCH node gets the message from the queue.
  2. The SURFWATCH node refers to information in the message set, where the structure of the message is defined, to verify that the message has the correct structure. If the message has the correct structure, the SURFWATCH node passes the message, through its Out terminal, to the Mapping node. Alternatively, if there is a problem identifying the message, the SURFWATCH node passes the message, through its Failure terminal, to the SURFWATCH_FAIL node, which puts the message on the SURFWATCH_FAIL queue.
  3. The Mapping node transforms the message by converting the surf report message into a plain pager message. The Mapping node refers to the message set to understand, or parse, the structure of the input message and to construct the output message.
  4. The Publish Reports node checks for a subscription that matches the topic name under which the message will be published. If there is a subscription to that topic, the Publish Reports node publishes the message on the PAGER queue. The Pager application then gets the message from the PAGER queue.

The SurfWatch and Pager message definitions

When the SurfWatch message flow transforms the message from the surf report format to pager format, it has to understand both the structure of the surf report input message and the structure of the pager output message. The structures of the messages are defined in an external message set, to which the message flow refers. Without these message definitions, more complicated nodes in the message flow, such as the Mapping node, would not be able to process the incoming information; the Mapping node has to refer to information in the message definitions to process the message.

When you use the Surf Report Publisher application to subscribe to surf reports concerning, for example, the Haleiwa beach, the message that enters the message flow looks like the following message:

<SurfWatch>
<TimeDate>21.05.03 09:52:13</TimeDate>
<Break>Pipeline</Break>
<Waves>4</Waves>
<Wind>Side-offshore</Wind>
</SurfWatch>

The Mapping node, transforms the message from a surf report message into a plain pager message. When the message leaves the message flow, it looks like the following message:

<Pager>
<text>SurfWatch 21.05.03 09:52:13 Pipeline: Side-offshore, waves 4m.</text>
</Pager>

Back to sample home