Avoiding error messages in connecting to active/passive ActiveMQ

Viewed 75

I am creating a program to send messages to ActiveMQ. This server is in active/passive configuration with one active and two standby nodes. My code for creating connections as follows:

String furl = "failover:(tcp://aa.myamq-01:61616:tcp://aa.myamq-02:61616:tcp://aa.myamq-03:61616");
ConnectionFactory = new ActiveMQConnectionFactory(furl);
Connection connection = ConnectionFactory.createConnection();
connection.start();

Everything works as expected. However I get the following output in the console.

ERROR | Connect fail to tcp://aa.myamq-01:61616, error message : Connection refused:Connect
ERROR | Connect fail to tcp://aa.myamq-02:61616, error message : Connection refused:Connect
INFO |Successfully connected to tcp://aa.myamq-03:61616

Is there a way the active server can be identified and connection attempted to it only? Alternatively, can the error messages be suppressed?

1 Answers

AFAIK there isn't in this scenario. Inactive ActiveMQ nodes are actually not accepting connections. Therefor they look like they are down.

But if you would need to find out which node is master you can find that in DB if you use DB backend in ActiveMQ.

Regarding suppressing this message I would not even try to do that because if there would be a regular failure you will not notice it.

Related