public final class ConnectionLogger extends Object implements QmfEventListener
In default mode ConnectionLogger lists the connections made to a broker along with information about sessions such as whether any subscriptions are associated with the session (if a session has no subscriptions then it's quite likely to be a "producer only" session, so this knowledge is quite useful).
In "log queue and binding" mode the information provided is very similar to qpid-config -b queues but with additional connection related information provided as with default mode.
Usage: ConnectionLogger [options]
Options:
-h, --help show this help message and exit
-q log queue and binding information for consumer connection
-a <address>, --broker-address=<address>
broker-addr is in the form: [username/password@]
hostname | ip-address [:<port>] ex: localhost,
10.1.1.7:10000, broker-host:10000,
guest/guest@localhost
--sasl-mechanism=<mech>
SASL mechanism for authentication (e.g. EXTERNAL,
ANONYMOUS, PLAIN, CRAM-MD5, DIGEST-MD5, GSSAPI). SASL
automatically picks the most secure available
mechanism - use this option to override.
| Constructor and Description |
|---|
ConnectionLogger(String url,
String connectionOptions,
boolean logQueues)
Basic constructor.
|
public ConnectionLogger(String url, String connectionOptions, boolean logQueues)
url - the connection URL.connectionOptions - the options String to pass to ConnectionHelper.logQueues - flags whether queue & binding information is logged as well as connection info.public void onEvent(WorkItem wi)
This method looks for clientConnect or clientDisconnect Events and uses these as a trigger to log the new connection state when the next Heartbeat occurs.
There are a couple of reasons for using this approach rather than just calling logConnectionInformation() as soon as we see the clientConnect or clientDisconnect Event.
1. We could potentially have lots of connection Events and redisplaying all of the connections for each Event is likely to be confusing.
2. When a clientConnect Event occurs we don't have all of the informatin that we might need, for example this application checks the Session and Subscription information and also optionally Queue and Binding information. Creating Sessions/Subscriptions won't generally occur until some (possibly small, but possibly not) time after the Connection has been made. The approach taken here reduces spurious assertions that a Session is probably a "producer only" Session. As one of the use-cases for this tool is to attempt to flag up "producer only" Sessions we want to try and make it as reliable as possible.
onEvent in interface QmfEventListenerwi - a QMF2 WorkItem objectpublic static void main(String[] args)
args - the command line arguments.Copyright © 2006–2014 The Apache Software Foundation. All rights reserved.