Example 1: The following table contains sample rows and 3columns in the "informix".mqipubsub table. 3
3 3| 3 | pubsubname column | 3receiver column | 3pubsubtype column | 3
|---|---|---|---|
| Sample row 1 | 3
3 'IDS.DEFAULT. 3PUBLISHER' 3 |
3'' | 3'Publisher' | 3
| Sample row 2 | 3
3 'IDS.DEFAULT. 3SUBSCRIBER' 3 |
3
3 'IDS.DEFAULT. 3SUBSCRIBER.RECEIVER' 3 |
3'Subscriber' | 3
3
3begin; 3EXECUTE FUNCTION MQSubscribe('IDS.DEFAULT.SUBSCRIBER', 3 'IDS.DEFAULT.PUB.SUB.POLICY', 'Weather'); 3commit;3
The above statement demonstrates a subscriber registering an 3interest in messages containing the topic "Weather" with the following 3parameters: 3
3begin; 3EXECUTE FUNCTION MQPublish('IDS.DEFAULT.PUBLISHER', 3'IDS.DEFAULT.PUB.SUB.POLICY', 'Rain', 'Weather'); 3commit;3
The above statement publishes the message with the following 3parameters: 3
3begin; 3EXECUTE FUNCTION MQReceive('IDS.DEFAULT.SUBSCRIBER.RECEIVER', 3'IDS.DEFAULT.PUB.SUB.POLICY'); 3commit;3
The above statement receives the message with the following parameters 3(it returns "Rain"): 3
3Example 2: 3
3begin; 3EXECUTE FUNCTION MQSubscribe('Weather'); 3commit;3
This example demonstrates a subscriber registering an interest 3in messages containing the topic "Weather" with the following parameters: 3
3Example 3: 3
3begin; 3EXECUTE FUNCTION MQSubscribe('PORTFOLIO-UPDATES', 'BASIC-POLICY', 'Stocks:Bonds'); 3commit;3
This example demonstrates a subscriber registering an interest 3in messages containing the topics "Stocks" and "Bonds" with the 3following parameters: 3
3