ASFClient5.java

 

This sample exercises the durable publish/subscribe ConnectionConsumer functionality in WebSphere MQ JMS.

You invoke it with the same command-line options as the ASFClient4 sample, and, as with the other samples, the TopicLoad sample application can be used to trigger the consumer that is created. For details of TopicLoad, see TopicLoad.java.

When invoked, ASFClient5 displays a menu of three options:

   1. Create/reactivate a durable ConnectionConsumer
   2. Unsubscribe a durable ConnectionConsumer
   X. Exit

If you choose option 1, and this is the first time this sample has been run, a new durable ConnectionConsumer is created using the given name. It then displays one minute's worth of throughput statistics, rather like the other samples, before closing the connection and terminating.

Having created a durable consumer, messages published on the topic in question continues to arrive at the consumer's destination even though the consumer is inactive.

This can be confirmed by running ASFClient5 again, and selecting option 1. This reactivates the named durable consumer, and the statistics displayed show that any relevant messages published during the period of inactivity were subsequently delivered to the consumer.

If you run ASFClient5 again and select option 2, this unsubscribes the named durable ConnectionConsumer and discards any outstanding messages delivered to it. Do this to ensure that the broker does not continue to deliver unwanted messages.


uj25780_