Package org.apache.qpid.qmf2.common

Examples of org.apache.qpid.qmf2.common.QmfEvent


    public void onEvent(final WorkItem wi)
    {
        if (wi instanceof EventReceivedWorkItem)
        {
            EventReceivedWorkItem item = (EventReceivedWorkItem)wi;
            QmfEvent event = item.getEvent();
            String className = event.getSchemaClassId().getClassName();
            if (className.equals("subscribe"))
            {
                readWhitelist();
                String queueName = event.getStringValue("qName");
                String address = event.getStringValue("rhost");
                String timestamp = new Date(event.getTimestamp()/1000000l).toString();
                validateQueue(queueName, address, timestamp);
            }
        }
        else if (wi instanceof AgentRestartedWorkItem)
        {
View Full Code Here


    {
        if (wi instanceof EventReceivedWorkItem)
        {
            EventReceivedWorkItem item = (EventReceivedWorkItem)wi;
            Agent agent = item.getAgent();
            QmfEvent event = item.getEvent();

            String className = event.getSchemaClassId().getClassName();
            if (className.equals("clientConnect") ||
                className.equals("clientDisconnect"))
            {
                _stateChanged = true;
            }
View Full Code Here

    {
        if (wi instanceof EventReceivedWorkItem)
        {
            EventReceivedWorkItem item = (EventReceivedWorkItem)wi;
            Agent agent = item.getAgent();
            QmfEvent event = item.getEvent();
            String className = event.getSchemaClassId().getClassName();

            if (className.equals("queueDeclare"))
            {
                updateQueueCache();
            }
            else if (className.equals("queueThresholdExceeded"))
            {
                String queueName = event.getStringValue("qName");
                boolean matches = false;
                for (Pattern x : _filter)
                { // Check the queue name against the regexes in the filter List (if any)
                    Matcher m = x.matcher(queueName);
                    if (m.find())
                    {
                        matches = true;
                        break;
                    }
                }

                if (_filter.isEmpty() || matches)
                { // If there's no filter enabled or the filter matches the queue name we call purgeQueue().
                    long msgDepth = event.getLongValue("msgDepth");
                    purgeQueue(queueName, msgDepth);
                }
            }
        }
    }
View Full Code Here

    public void onEvent(final WorkItem wi)
    {
        if (wi instanceof EventReceivedWorkItem)
        {
            EventReceivedWorkItem item = (EventReceivedWorkItem)wi;
            QmfEvent event = item.getEvent();
            System.out.println(event + " broker=" + _url);
        }
    }
View Full Code Here

                        _agent.methodResponse(methodName, item.getHandle(), inArgs, null);
                    }
                    else if (methodName.equals("event"))
                    {
                        System.out.println("Invoked event method");
                        QmfEvent event = new QmfEvent(_eventSchema);
                        event.setSeverity((int)inArgs.getLongValue("severity"));
                        event.setValue("text", inArgs.getStringValue("text"));
                        _agent.raiseEvent(event);
                        _agent.methodResponse(methodName, item.getHandle(), null, null);
                    }
                    else if (methodName.equals("fail"))
                    {
View Full Code Here

            // The results of an Event delivered from an Agent
            if (opcode.equals("_data_indication") && content.equals("_event"))
            { // There are differences in the type of message sent by Qpid 0.8 and 0.10 onwards.
                if (AMQPMessage.isAMQPMap(message))
                { // 0.8 broker passes Events as amqp/map encoded as MapMessages (we convert into java.util.Map)
                    _eventListener.onEvent(new EventReceivedWorkItem(agent, new QmfEvent(AMQPMessage.getMap(message))));
                }
                else if (AMQPMessage.isAMQPList(message))
                { // 0.10 and above broker passes Events as amqp/list encoded as BytesMessage (needs decoding)
                  // 0.20 encodes amqp/list in a MapMessage!!?? AMQPMessage hopefully abstracts this detail.
                    List<Map> list = AMQPMessage.getList(message);
                    for (Map m : list)
                    {
                        _eventListener.onEvent(new EventReceivedWorkItem(agent, new QmfEvent(m)));
                    }
                }
                else
                {
                    _log.info("onMessage() Received Event message in incorrect format");
View Full Code Here

        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)
View Full Code Here

        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)
View Full Code Here

        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)
View Full Code Here

     * Factory method to create an Unbind Event Object with timestamp of now.
     * @return the newly created Unbind Event Object.
     */
    public QmfEvent createUnbindEvent()
    {
        QmfEvent unbind = new QmfEvent(_unbindSchema);
        unbind.setSeverity("info");
        unbind.setValue("exName", _binding.getAttribute("exchange"));
        unbind.setValue("key", _binding.getName());
        unbind.setValue("qName", _binding.getAttribute("queue"));
        // TODO Not sure of a way to get these for Java Broker Exchange.
        //unbind.setValue("rhost", _connection.getName());
        //unbind.setValue("user", getStringValue("authIdentity"));
        return unbind;
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.qmf2.common.QmfEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.