Red Hat DocumentationFuse Message BrokerToggle FramesPrintFeedback

HierarchicalChat Application

What the sample does

Fuse Message Broker supports a hierarchical topic structure that allows wildcard subscriptions.

Each application instance specifies a publish topic and a subscribe topic, as follows:

  • Chat:

    • Publish to jms.samples.chat

    • Subscribe to jms.samples.chat

  • DurableChat:

    • Publish to jms.samples.durablechat

    • Subscribe to jms.samples.durablechat

  • HierarchicalChat:

    • Publish to jms.samples.hierarchicalchat

    • Subscribe to jms.samples.*

You can see that each of the applications is publishing to a different topic. However, the HierarchicalChat application is subscribing to a topic that ends in asterisk (*), a wildcard that accepts any topic with the root jms.samples. It is important to note that this is referred to a hierarchical wildcard, as it must be adjacent to dot delimiters.

Running the sample

To run the HierarchicalChatting sample do the following:

  1. In window 1, enter ant chat1

  2. In window 2, enter ant durable1

  3. In window 3, enter ant wildcard

  4. In the wildcard window, enter some text and then press Enter.

    The message is displayed in only that window.

  5. In the chat1 window, enter some text and then press Enter.

    The message is displayed in that window and in the wildcard window.

  6. In the durable1 window, enter some text and then press Enter.

    The message is displayed in that window and in the wildcard window.

Stopping the sample

To stop the applications, press Ctrl+C in each of the windows.

Comments powered by Disqus