+

Search Tips | Advanced Search

Sending and receiving test publications

We can send (publish) and receive (subscribe to) test publications (messages) to check that your broker network and topics work as intended. We can configure a publication so that the broker retains a copy after publishing it to the subscribers. This enables new subscribers to receive the publication even if they subscribed after it was published.


Before you begin

Note: This information is for IBM® WebSphere MQ Version 6.0 queue managers only. Before you start sending and receiving test publications:


About this task

To send and receive test publications:


Procedure

  1. Subscribe to the topic to test:
    1. In the Navigator view, expand the queue manager that hosts the broker.
    2. Right-click the Topics folder, then click Test Subscription.... The Subscribe application opens.
  2. Publish a message to the same topic:
    1. In the Navigator view, expand the queue manager that hosts the broker.
    2. Right-click the Topics folder, then click Test Publication.... The Publish Test Message application opens.
    3. Optional: In the Stream field, select a different stream.
    4. In the Topic field, type the name of the topic on which you want to publish the message. You or another publisher can already be registered to publish on the topic, or we can enter a new topic name. When you publish the message, you are automatically registered as a publisher on the topic.
    5. In the Message data field, type a message to send in the publication. For example, type Hello, world!
    6. Click Publish message to send the message to the broker.
    The subscriber receives the message (the publication).
  3. Start another instance of the Subscribe application. The second Subscribe application does not receive the message that was published by the Publish Test Message application because it was not subscribing to the topic at the time that the publication was sent to the broker.
  4. Unsubscribe the second Subscribe instance from the topic.
    1. In the second Subscribe application, click Unsubscribe. The second Subscribe application can no longer receive publications on that topic. The first Subscribe application can still receive publications on that topic.
  5. Publish a retained publication to the topic.
    1. In the Publish application, select the Retained message check box.
    2. Change the text in the Message data field. For example, type Hi, I'm home.
    3. Click Publish message. The retained publication is published to the broker. The first Subscribe application receives the retained publication. The second Subscribe application does not receive the publication because it is currently not subscribed.
  6. Subscribe the second Subscribe application to the topic again:
    1. In the second Subscribe application, click Subscribe. The second Subscribe application is subscribed to the topic again and receives the retained publication because the broker kept a copy of the retained publication.


Results

You have now published and subscribed to test publications, including retained publications.