Menu Search

13.8. Qpid JMX API for HA

Qpid exposes the BDB HA store information via its JMX interface and provides APIs to remove a Node from the group, update a Node IP address, and assign a Node as the designated primary.

An instance of the BDBHAMessageStore MBean is instantiated by the broker for the each virtualhost using the HA store.

The reference to this MBean can be obtained via JMX API using an ObjectName like org.apache.qpid:type=BDBHAMessageStore,name="<virtualhost name>" where <virtualhost name> is the name of a specific virtualhost on the broker.

Mbean BDBHAMessageStore attributes
Name Type Accessibility Description
GroupName String Read only Name identifying the group
NodeName String Read only Unique name identifying the node within the group
NodeHostPort String Read only Host/port used to replicate data between this node and others in the group
HelperHostPort String Read only Host/port used to allow a new node to discover other group members
NodeState String Read only Current state of the node
ReplicationPolicy String Read only Node replication durability
DesignatedPrimary boolean Read/Write Designated primary flag. Applicable to the two node case.
CoalescingSync boolean Read only Coalescing sync flag. Applicable to the master sync policies NO_SYNC and WRITE_NO_SYNC only.
getAllNodesInGroup TabularData Read only Get all nodes within the group, regardless of whether currently attached or not
Mbean BDBHAMessageStore operations
Operation Parameters Returns Description

nodeName, name of node, string

void Remove an existing node from the group
  • nodeName, name of node, string

  • newHostName, new host name, string

  • newPort, new port number, int

void Update the address of another node. The node must be in a STOPPED state.

Figure 13.7. BDBHAMessageStore view from jconsole.

BDBHAMessageStore view from jconsole.

Example 13.3. Example of java code to get the node state value

Map<String, Object> environment = new HashMap<String, Object>();

// credentials: user name and password
environment.put(JMXConnector.CREDENTIALS, new String[] {"admin","admin"});
JMXServiceURL url =  new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:9001/jmxrmi");
JMXConnector jmxConnector = JMXConnectorFactory.connect(url, environment);
MBeanServerConnection mbsc =  jmxConnector.getMBeanServerConnection();

ObjectName queueObjectName = new ObjectName("org.apache.qpid:type=BDBHAMessageStore,name=\"test\"");
String state = (String)mbsc.getAttribute(queueObjectName, "NodeState");

System.out.println("Node state:" + state);

Example system output:

Node state:MASTER