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.
| 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 |
| Operation | Parameters | Returns | Description |
| removeNodeFromGroup |
nodeName, name of node, string |
void | Remove an existing node from the group |
| updateAddress |
|
void | Update the address of another node. The node must be in a STOPPED state. |
Example 12.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
