Home | Previous Page | Next Page   MQ DataBlade Module > MQ DataBlade Functions > MQSubscribe() > 3 3 3

Examples

3

Example 1: The following table contains sample rows and 3columns in the "informix".mqipubsub table. 3

3 333333333333333333333333
pubsubname column receiver column pubsubtype column
Sample row 1 3
'IDS.DEFAULT.
3PUBLISHER'
3
'' 'Publisher'
Sample row 2 3
'IDS.DEFAULT.
3SUBSCRIBER'
3
3
'IDS.DEFAULT.
3SUBSCRIBER.RECEIVER'
3
'Subscriber'

3

3
begin;
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

3 3

3
begin;
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

3 3

3
begin;
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

3 3

Example 2: 3

3
begin;
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

3 3

Example 3: 3

3
begin;
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 Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]