Search in sources :

Example 6 with AgentHeartbeatWorkItem

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());
    }
}
Also used : Agent(org.apache.qpid.qmf2.console.Agent) AgentHeartbeatWorkItem(org.apache.qpid.qmf2.console.AgentHeartbeatWorkItem)

Example 7 with AgentHeartbeatWorkItem

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);
                }
            }
        }
    }
}
Also used : Agent(org.apache.qpid.qmf2.console.Agent) SubscriptionIndicationWorkItem(org.apache.qpid.qmf2.console.SubscriptionIndicationWorkItem) ObjectId(org.apache.qpid.qmf2.common.ObjectId) AgentHeartbeatWorkItem(org.apache.qpid.qmf2.console.AgentHeartbeatWorkItem) EventReceivedWorkItem(org.apache.qpid.qmf2.console.EventReceivedWorkItem) QmfEvent(org.apache.qpid.qmf2.common.QmfEvent) MethodResponseWorkItem(org.apache.qpid.qmf2.console.MethodResponseWorkItem) SubscribeIndication(org.apache.qpid.qmf2.console.SubscribeIndication) ObjectUpdateWorkItem(org.apache.qpid.qmf2.console.ObjectUpdateWorkItem) SubscribeParams(org.apache.qpid.qmf2.console.SubscribeParams) SubscribeResponseWorkItem(org.apache.qpid.qmf2.console.SubscribeResponseWorkItem) QmfConsoleData(org.apache.qpid.qmf2.console.QmfConsoleData) MethodResult(org.apache.qpid.qmf2.console.MethodResult)

Aggregations

AgentHeartbeatWorkItem (org.apache.qpid.qmf2.console.AgentHeartbeatWorkItem)6 QmfEvent (org.apache.qpid.qmf2.common.QmfEvent)5 Agent (org.apache.qpid.qmf2.console.Agent)5 ObjectId (org.apache.qpid.qmf2.common.ObjectId)4 EventReceivedWorkItem (org.apache.qpid.qmf2.console.EventReceivedWorkItem)4 QmfConsoleData (org.apache.qpid.qmf2.console.QmfConsoleData)4 MethodResponseWorkItem (org.apache.qpid.qmf2.console.MethodResponseWorkItem)3 MethodResult (org.apache.qpid.qmf2.console.MethodResult)3 ObjectUpdateWorkItem (org.apache.qpid.qmf2.console.ObjectUpdateWorkItem)3 SubscribeIndication (org.apache.qpid.qmf2.console.SubscribeIndication)3 SubscriptionIndicationWorkItem (org.apache.qpid.qmf2.console.SubscriptionIndicationWorkItem)3 AgentRestartedWorkItem (org.apache.qpid.qmf2.console.AgentRestartedWorkItem)2 SubscribeParams (org.apache.qpid.qmf2.console.SubscribeParams)2 SubscribeResponseWorkItem (org.apache.qpid.qmf2.console.SubscribeResponseWorkItem)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Matcher (java.util.regex.Matcher)1