use of org.apache.qpid.qmf2.console.AgentHeartbeatWorkItem in project qpid by apache.
the class BigPayloadAgentTestConsole method onEvent.
public void onEvent(WorkItem wi) {
if (wi.getType() == AGENT_HEARTBEAT) {
AgentHeartbeatWorkItem item = (AgentHeartbeatWorkItem) wi;
Agent agent = item.getAgent();
System.out.println(agent.getName());
}
}
use of org.apache.qpid.qmf2.console.AgentHeartbeatWorkItem in project qpid by apache.
the class BrokerSubscriptionTestConsole method onEvent.
public void onEvent(WorkItem wi) {
System.out.println("WorkItem type: " + wi.getType());
if (wi.getType() == AGENT_HEARTBEAT) {
AgentHeartbeatWorkItem item = (AgentHeartbeatWorkItem) wi;
Agent agent = item.getAgent();
System.out.println(agent.getName());
}
if (wi.getType() == EVENT_RECEIVED) {
EventReceivedWorkItem item = (EventReceivedWorkItem) wi;
Agent agent = item.getAgent();
QmfEvent event = item.getEvent();
String className = event.getSchemaClassId().getClassName();
System.out.println("Event: " + className);
// event.listValues();
}
if (wi.getType() == METHOD_RESPONSE) {
MethodResponseWorkItem item = (MethodResponseWorkItem) wi;
MethodResult result = item.getMethodResult();
String correlationId = item.getHandle().getCorrelationId();
System.out.println("correlationId = " + correlationId);
System.out.println(result.getStringValue("message"));
}
if (wi.getType() == OBJECT_UPDATE) {
ObjectUpdateWorkItem item = (ObjectUpdateWorkItem) wi;
QmfConsoleData object = item.getQmfConsoleData();
ObjectId objectId = object.getObjectId();
String correlationId = item.getHandle().getCorrelationId();
System.out.println("correlationId = " + correlationId);
System.out.println("objectId = " + objectId);
System.out.println("MethodCount = " + object.getLongValue("methodCount"));
}
if (wi.getType() == SUBSCRIBE_RESPONSE) {
SubscribeResponseWorkItem item = (SubscribeResponseWorkItem) wi;
SubscribeParams params = item.getSubscribeParams();
System.out.println("duration = " + params.getLifetime());
System.out.println("interval = " + params.getPublishInterval());
System.out.println("subscriptionId = " + params.getSubscriptionId());
System.out.println("consoleHandle = " + params.getConsoleHandle());
String correlationId = item.getHandle().getCorrelationId();
System.out.println("correlationId = " + correlationId);
}
if (wi.getType() == SUBSCRIPTION_INDICATION) {
SubscriptionIndicationWorkItem item = (SubscriptionIndicationWorkItem) wi;
SubscribeIndication indication = item.getSubscribeIndication();
String correlationId = indication.getConsoleHandle();
System.out.println("correlationId = " + correlationId);
List<QmfConsoleData> objects = indication.getData();
for (QmfConsoleData object : objects) {
if (object.isDeleted()) {
System.out.println("object has been deleted");
}
String className = object.getSchemaClassId().getClassName();
System.out.println("object class = " + className);
if (className.equals("queue") || className.equals("exchange")) {
if (object.hasValue("name")) {
System.out.println("property update, name = " + object.getStringValue("name"));
} else {
_objectId = object.getObjectId();
System.out.println("statistic update, oid = " + _objectId);
}
}
}
}
}
Aggregations