1 of 1 people found this helpful
Hornetq does not have a traditional clustered queue. But can be configured to act similarily to one.
What you can do is have client side load-balancing. Mean the hornetq client knows about the 2 servers and itself round robin the messages between the servers.
Another way is to configure a cluster connection between the two servers. This where a Core Bridge is automatically configured for you to redistribute message between the servers with same name queues. This way a client can have knowledge of one server send all message to that server and the cluster core bridge would take message from it and forward to the second server.
This is just for load balancing, HA and fail over has completely different configuration involved.
Thank's for your answer,
can you explain more about the second method(A link about it will be fine)
noe more question is how do i send message to this server :
"run.bat -c nodeB -Djboss.service.binding.set=ports-01 -Djboss.messaging.ServerPeerID=2"
I try this -
Properties p = new Properties();
context = new InitialContext(p);
But still the first server is receving the message, am I doing something wrong ?
First the -Djboss.messaging.ServerPeerID=2 is not used by hornetq, that was used in the original jboss messaging on 5.1. The server id configuration in hornetq is only used if you have multiple hornetq servers running in the same jvm or maybe machine, not sure which.
Second the hornetq uses ipaddress to connect between servers(at least message broker does), that mean you cannot use bind address of 0.0.0.0 or localhost starting the jboss server. So if you configure the hornetq to start using the same jboss.bind.address and you start with 0.0.0.0 that wont work. You can either configure the hornetq bind address as a separate environment variable or change the jboss.bind.address to real ip address. Keep in mind localhost access will no longer work if you do the latter.
This will help you with cluster connection for message redistribution with cluster.
Message redistribution with queues.
If you have low number of server you can manually specify the cluster servers yourself.
I also recommend you download the source code to hornetq, they have examples configuration. You just need to combine static cluster example with message redistribution example and you're good to go.