Package org.apache.qpid.qmf2.common

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


     * Factory method to create an Unsubscribe Event Object with timestamp of now.
     * @return the newly created Unsubscribe Event Object.
     */
    public QmfEvent createUnsubscribeEvent()
    {
        QmfEvent unsubscribe = new QmfEvent(_unsubscribeSchema);
        unsubscribe.setSeverity("info");
        unsubscribe.setValue("dest", getStringValue("name"));
        // TODO Not sure of a way to get these for Java Broker Subscription.
        //unsubscribe.setValue("rhost", _connection.getName());
        //unsubscribe.setValue("user", getStringValue("authIdentity"));
        return unsubscribe;
    }
View Full Code Here


     * Factory method to create a Queue Declare Event Object with timestamp of now.
     * @return the newly created Queue Declare Event Object.
     */
    public QmfEvent createQueueDeclareEvent()
    {
        QmfEvent queueDeclare = new QmfEvent(_queueDeclareSchema);
        queueDeclare.setSeverity("info");
        // TODO the _alternateExchangeName gets set some time after the Constructor - how do I get its value for
        // the queueDeclareEvent???!!!
        queueDeclare.setValue("altEx", _alternateExchangeName);
        queueDeclare.setValue("args", Collections.EMPTY_MAP); // TODO
        queueDeclare.setValue("autoDel", getBooleanValue("autoDelete"));
        queueDeclare.setValue("disp", "created");
        queueDeclare.setValue("durable", getBooleanValue("durable"));
        queueDeclare.setValue("excl", getBooleanValue("exclusive"));
        queueDeclare.setValue("qName", getStringValue("name"));
        // TODO Not sure of a way to get these for Java Broker Exchange.
        //queueDeclare.setValue("rhost", _connection.getName());
        //queueDeclare.setValue("user", getStringValue("authIdentity"));
        return queueDeclare;
    }
View Full Code Here

     * Factory method to create a Queue Delete Event Object with timestamp of now.
     * @return the newly created Queue Delete Event Object.
     */
    public QmfEvent createQueueDeleteEvent()
    {
        QmfEvent queueDelete = new QmfEvent(_queueDeleteSchema);
        queueDelete.setSeverity("info");
        queueDelete.setValue("qName", getStringValue("name"));
        // TODO Not sure of a way to get these for Java Broker Exchange.
        //queueDelete.setValue("rhost", _connection.getName());
        //queueDelete.setValue("user", getStringValue("authIdentity"));
        return queueDelete;
    }
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 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

    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

     * Factory method to create a Bind Event Object with timestamp of now.
     * @return the newly created Bind Event Object.
     */
    public QmfEvent createBindEvent()
    {
        QmfEvent bind = new QmfEvent(_bindSchema);
        bind.setSeverity("info");
        bind.setValue("args", _binding.getArguments());
        bind.setValue("exName", _binding.getExchange().getName());
        bind.setValue("key", _binding.getName());
        bind.setValue("qName", _binding.getQueue().getName());
        // TODO Not sure of a way to get these for Java Broker Exchange.
        //bind.setValue("rhost", _connection.getName());
        //bind.setValue("user", getStringValue("authIdentity"));
        return bind;
    }
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.getExchange().getName());
        unbind.setValue("key", _binding.getName());
        unbind.setValue("qName", _binding.getQueue().getName());
        // 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.