Home
Introduction to writing publish/subscribe applications
Applications use command messages to communicate with the broker when they want to publish or subscribe to information.
These messages use the WebSphere MQ Rules and Formatting Header (RF Header).
The content of each command message starts with an MQRFH structure. This structure contains a name/value string, which defines the type of command the message represents and any parameters associated with the command. In the case of a Publish command message, the name/value string is usually followed by the data to be published, in any format specified by the user. Broker responses to command messages also use the MQRFH structure.
The normal Message Queue Interface (MQI) calls (such as MQPUT and MQGET) can be used to put RF Header command messages to the broker queue, and to retrieve response messages and publications from their respective queues.
Most command messages are sent to the broker's control queue...
SYSTEM.BROKER.CONTROL.QUEUE...but Publish and Delete Publication command messages are sent to the appropriate stream queue at the broker, for example...
SYSTEM.BROKER.DEFAULT.STREAMAlternatively, we can use the WebSphere MQ Application Messaging Interface (AMI) to send messages to and receive them from the broker. The AMI constructs and interprets the fields in the RF Header, so you don't need to understand its structure. In addition, the application programmer is not concerned with details of how WebSphere MQ sends the message. These details (for instance, the queue name and fields in the message descriptor) are contained in AMI services and policies set up by a system administrator. The AMI is available as a SupportPac.
This chapter describes the things that we need to know before you start writing a publisher or subscriber application. It discusses the following topics:
- Message flows
- Message ordering
- Publisher and subscriber identity
- The message descriptor
- Persistence and units of work
- Limitations
- Use the Application Messaging Interface
We can find more information about writing applications in the following chapters:
- Write publisher applications
- Write subscriber applications
- Format of command messages
- Publish/Subscribe command messages
- Error handling and response messages
- Find out about other publishers and subscribers
Sample programs to illustrate the techniques used are described in Sample programs.
Home