Subscribe to a queue
To subscribe to a queue, use the MQSubscribe() function.
The following example shows how a database application
subscribes to a queue to receive messages for a topic named
Weather:
--- before subscribe
Topic: MQ/TIMESERIES.QUEUE.MANAGER /StreamSupport
Topic: MQ/S/TIMESERIES.QUEUE.MANAGER /Subscribers/Identities/*
Topic: MQ/S/TIMESERIES.QUEUE.MANAGER /Subscribers/Identities/*
Topic: MQ/S/TIMESERIES.QUEUE.MANAGER /Subscribers/Identities/*
BEGIN WORK;
EXECUTE FUNCTION MQSubscribe('AMT.SAMPLE.SUBSCRIBER', 'AMT.SAMPLE.PUB.SUB.POLICY',
'Weather');
(expression) 1
1 row(s) retrieved.
--- after subscribe
Topic: MQ/TIMESERIES.QUEUE.MANAGER /StreamSupport
Topic: MQ/S/TIMESERIES.QUEUE.MANAGER /Subscribers/Identities/*
Topic: Weather
Topic: MQ/S/TIMESERIES.QUEUE.MANAGER /Subscribers/Identities/*
Topic: MQ/S/TIMESERIES.QUEUE.MANAGER /Subscribers/Identities/*
COMMIT WORK;