Red Hat DocumentationFuse Message BrokerToggle FramesPrintFeedback

DurableChat Application

What the sample does

In Pub/Sub messaging, when messages are produced, they are sent to all active consumers who subscribe to a topic. Some subscribers register an enduring interest in receiving messages that were sent while they were inactive. These durable subscriptions are permanent records in the broker's persistent storage mechanism.

Running the sample

To run the DurableChatting sample do the following:

  1. In window 1, enter ant durable1.

  2. In window 2, enter ant durable2.

  3. Type text in each window and press Enter. Each window displays all the messages. Connected durable subscribers are the same as connected nondurable subscribers.

  4. In window 2, press Ctrl+C.

  5. In window 1, type text, and press Enter.

  6. In window 2, enter ant durable2 again.

    When the window opens, it first displays all the messages that were stored for its subscription. (If you waited a while, messages sent more than 30 minutes ago were dropped.)

  7. In window 3, enter ant durable3.

    In the console window that opens, no messages are displayed. While it is a durable subscriber, it had not yet established its durable subscription on this broker topic.

    Important

    If this sample has run against this broker before this run, the durable interest has been established so you do get the stored messages. You could unsubscribe the user from the durable subscription, but in the scope of this JMS exploration, you might find it as easy to close all the open windows, delete the /data directory, and then restart the exploration.

Important

While some applications tolerate multiple instances of the same user producing or consuming on the same destination, running a second instance of one of these DurableChatter scripts fails (as it should) with the error (in the broker's console window):

InvalidClientIDException:
Broker:localhost, Client:DurableChatter_n already connected

Stopping the sample

To stop the DurableChat sessions press Ctrl+C in each of the windows.

Comments powered by Disqus