Send and receiving test publications on a topic object folder
We can send (publish) and receive (subscribe to) test publications (messages) to check that your Publish/Subscribe Engine network and topics work as intended. We can configure a publication so that the Publish/Subscribe Engine 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 starting
Before you start:
About this task
To send and receive test publications for any topic:
Procedure
- Subscribe to the topic that we want to test:
- In the Navigator view, expand the queue manager that hosts the Publish/Subscribe Engine.
- Right-click the Topics folder, then click Test Subscription.... The Subscribe application opens.
- Type a topic string in the Topic String field. The topic string must be the same name as the publisher.
- Publish a message to the same topic:
- In the Navigator view, expand the queue manager that hosts the Publish/Subscribe Engine.
- Right-click the Topics folder, then click Test Publication.... The Publish Test Message application opens.
- In the Topic field, type the name of the topic on which we 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 string. When you publish the message, we are automatically registered as a publisher on the topic.
- In the Message data field, type a message to send in the publication. For example, type Hello, world!
- Click Publish message to send the message to the Pub/Sub Engine.
The subscriber receives the message (the publication).
- 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 Publish/Subscribe Engine.
- Unsubscribe the second Subscribe instance from the topic.
- 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.
- Publish a retained publication to the topic.
- In the Publish Test Message application, select the Retained message check box.
- Change the text in the Message data field. For example, type Hi, I'm home.
- Click Publish message. The retained publication is published to the Publish/Subscribe Engine. The first Subscribe application receives the retained publication. The second Subscribe application does not receive the publication because it is currently not subscribed.
- Subscribe the second Subscribe application to the topic again:
- In the second Subscribe application, click Subscribe. The second Subscribe application is subscribed to the topic again and receives the retained publication because the Publish/Subscribe Engine kept a copy of the retained publication.
Results
We have now published and subscribed to test publications, including retained publications. Parent topic: Configure publish/subscribe for Version 7.0 and later queue managers
Related concepts