Red Hat DocumentationFuse Message BrokerToggle FramesPrintFeedback

Chat Application

What the sample does

In the Chat application, whenever anyone sends a text message to a given topic, all active applications running Chat receive that message as subscribers to that topic. This is the most basic form of publish and subscribe activity.

Running the sample

To run the chat sample do the following:

  1. In window 1, enter: ant chat1, then type Hello, and press Enter.

    Window 1 displays:

    Chatter_1: Hello
  2. In window 2, enter: ant chat2, then type Pronto, and press Enter.

    Both subscribers get the message so both windows display:

    Chatter_2: Pronto
  3. In window 3, enter: ant chat3, then type Bonjour, and press Enter.

    All three subscribers get the message, so each window displays:

    Chatter_3: Bonjour
  4. In window 3, stop chat3 by pressing Ctrl+C.

  5. Send some messages in the chat1 and chat2 windows.

  6. In window 3, run: ant chat3 again.

  7. Send some messages in the chat1 and chat2 windows.

    All three subscribers get the message. But Chatter_3 gets only the messages since it reconnected, and gets none of the messages that were sent while it was disconnected.

    If subscribers miss some of the messages, they pick up just the latest messages whenever they reconnect to the broker. Nothing is retained and nothing is guaranteed to be delivered, so throughput is fast.

Stopping the sample

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

Comments powered by Disqus