qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fadams <fraser.ad...@blueyonder.co.uk>
Subject QMF2 JMS ConnectionAudit client
Date Sun, 26 Jun 2011 13:01:43 GMT
Hello all,
There have been a few threads recently about using QMF2 with JMS:

"Java QMF console classes in org.apache.qpid.console seem very broken!!"
"Is it possible to write a client that gets notified of
connections/disconnections to broker?"

I got a lot of help from Gordon Sim and Rajith Attapattu (thanks guys!!) so
here's my chance to give back a little.

I've written a client called ConnectionAudit that Logs audit information
about each connection made to a specified broker.

It obtains connection, session and subscription objects and iterates in turn
through these comparing references to find the subscriptions association
with sessions and sessions associated with connections. Ultimately it then
displays the queues associated with each subscription.

It's not quite production quality, but it's not too far off (I'm still using
println/printf rather than log, but it does attempt connection retries if
the broker fails).

Note 1: This uses QMF2 so requires that the "--mgmt-qmf2 yes" option is
applied to the broker

Note 2: In order to use QMF2 the app-id field needs to be set. There appears
to be no way to set the AMQP 0-10 specific app-id field on a message which
the brokers QMFv2 implementation currently requires.

Gordon Sim has put together a patch for
org.apache.qpid.client.message.AMQMessageDelegate_0_10
Found in
client/src/main/java/org/apache/qpid/client/message/AMQMessageDelegate_0_10.java

    public void setStringProperty(String propertyName, String value) throws
JMSException
    {
        checkPropertyName(propertyName);
        checkWritableProperties();
        setApplicationHeader(propertyName, value);

        if ("x-amqp-0-10.app-id".equals(propertyName)) {
            _messageProps.setAppId(value.getBytes());
        }
    }

Note 3: I've only been able to test it with qpid 0.8. I'm currently having
problems building 0.10 on my Ubuntu box. There are differences between 0.8
and 0.10 that are significant - related to the way Event messages are
returned. 0.10 uses amqp/list encoded in a BytesMessage I've put some code
in place that "just may" work with this, but I have to stress that it hasn't
been tested!!!!!

I hope that this is useful/informative to folks.
Cheers,
Fraser
http://apache-qpid-users.2158936.n2.nabble.com/file/n6517128/ConnectionAudit.java
ConnectionAudit.java 






--
View this message in context: http://apache-qpid-users.2158936.n2.nabble.com/QMF2-JMS-ConnectionAudit-client-tp6517128p6517128.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Mime
View raw message