You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Event MBean

Events doesn't have operations because are representation of transient entities created on broker side.

Description

QMan JMX representation of a Qpid event exposed for monitoring. Note that there will be an event MBean instance for each event produced on Qpid side.
This chapter refers to the abstract interface that object will have.

Object Name

Q-MAN:brokerId=<BROKER_ID>,type=Event,package=<PACKAGE_NAME>,class=<CLASS_NAME>,objectId=<OBJECT_ID>

where :

Name

Description

Example

Q-MAN

QMan management domain. This is a fixed value.

N.A.

BROKER_ID

Broker identifier. This is a UUID assigned to each connected broker. Basically it indicates the (broker) owner of this event.

5004341d-7f3e-444a-b240-7d48030599f9

PACKAGE_NAME

The package name. A package is a grouping of class definitions that are related to a single software component. The package concept is used to extend the management schema beyond just the QPID software components.

org.apache.qpid.broker

CLASS_NAME

The class name. A class is a type definition for a manageable event.

bind, subscribe

Attributes

An Event MBean is a JMX representation of something that happened on Qpid side. Its state is basically composed by the arguments

The JMX interface of an event MBean lets you retrieve attributes metadata using the standard JMX API. The following example is showing that.

Example : retrieving attributes metadata
public class Example
{
	public static void main(String[] args) throws Exception
	{
		MBeanServer server = ManagementFactory.getPlatformMBeanServer();

		// Suppose the following is an object name associated with an existing managed domain instance.
		ObjectName objectName = ...;

		MBeanInfo mbeanMetadata = server.getMBeanInfo(objectName);

		// List all attributes (metadata, not values)
		for (MBeanAttributeInfo attribute : mbeanMetadata.getAttributes())
		{
			System.out.println("Name : "+attribute.getName());
			System.out.println("Description : "+attribute.getDescription());
			System.out.println("Type : "+attribute.getType());
			System.out.println("Is Readable : "+attribute.isReadable());
			System.out.println("Is Writable : "+attribute.isWritable());
		}
	}
}

Operations

getAttribute

Operation Name

Description

Return Type

getAttribute

This operation allows client to retrieve value of an mbean attribute (argument).

java.lang.Object

Argument Name

Description

Type

Nullable

Note

objectName

This is the name of the target MBean.

javax.management.ObjectName

No

N.A.

attributeName

This is the name of the requested attribute.

java.lang.String

No

N.A.

Example
public class Example
{
	public static void main(String[] args) throws Exception
	{
		MBeanServer server = ManagementFactory.getPlatformMBeanServer();

		// Suppose that this is an object name corresponding to a valid managed domain instance.
		ObjectName objectName = ...;

		// Suppose the mbean has an attribute (a statistic in this case) PendingMessagesCount
		Long attributeValue = (Long) server.getAttribute(objectName, "PendingMessagesCount");

		System.out.println("Attribute Value : "+attributeValue);
	}
}

Notifications

N.A.

  • No labels