Our first example is one of the simplest, yet one of the most needed ones when we need to create a cluster. Till now we have seen a single queue deployed on a single node. So we basically interacted with only one instance of HornetQ, both from the consumer, rather than from the consumer and producer layer.
In this case we change our scenario. We create two nodes for running different HornetQ server instances. Then we will use JMS to interact both at a producer level and at a consumer level to demonstrate that the cluster will share information between the two nodes.
JMS topics are part of the JMS specification and are basically a distribution mechanism for publishing messages that are delivered to multiple subscribers. From our point of view, you could think of a topic as a distributed queue where we can produce consumer messages.
From the code point of view, this will not affect anything except for the fact that we will use a topic instead of a queue...