Is there a way to detect which console is active in an ActiveMQ Artemis master/slave?

Viewed 23

We want to put a load-balancer (F5) pointing to web console of the ActiveMQ Artemis instance which is active.

1 Answers

The ActiveMQServerControl MBean has a method called isActive() which returns true if the broker is active and false if it is not. That should allow you to point the load-balancer at the proper web console.

The management API is exposed via JMX, management messages, HTTP (via Jolokia), etc. Here's an example using curl:

curl -H "Origin: http://localhost" -u myUser:myPass http://localhost:8161/console/jolokia/read/org.apache.activemq.artemis:broker=\"0.0.0.0\"/Active

This will return a JSON response, e.g.:

{
  "request": {
    "mbean": "org.apache.activemq.artemis:broker=\"0.0.0.0\"",
    "attribute": "Active",
    "type": "read"
  },
  "value": true,
  "timestamp": 1663085210,
  "status": 200
}
Related