...
Asynchronous Console Operations
QMF is built on top of a middleware messaging layer (Qpid Messaging). Because of this, QMF can use some communication patterns that are difficult to implement using network transports like UDP, TCP, or SSL. One of these patterns is called the Publication and Subscription pattern (pub-sub for short). In the pub-sub pattern, data sources publish information without a particular destination in mind. Data sinks (destinations) subscribe using a set of criteria that describes what kind of data they are interested in receiving. Data published by a source may be received by zero, one, or many subscribers.
QMF uses the pub-sub pattern to distribute events, object creation and deletion, and changes to properties and statistics. A console application using the QMF Console API can receive these asynchronous and unsolicited events and updates. This is useful for applications that store and analyze events and/or statistics. It is also useful for applications that react to certain events or conditions.
Note that console applications may always use the synchronous mechanisms.
Creating a Console Class to Receive Asynchronous Data
Asynchronous API operation occurs when the console application supplies a Console object to the session manager. The Console object (which overrides the qmf.console.Console class) handles all asynchronously arriving data. The Console class has the following methods. Any number of these methods may be overridden by the console application.
Method | Arguments | Invoked when... |
---|---|---|
brokerConnected | broker | a connection to a broker is established |
brokerDisconnected | broker | a connection to a broker is lost |
newPackage | name | a new package is seen on the QMF bus |
newClass | kind, classKey | a new class (event or object) is seen on the QMF bus |
newAgent | agent | a new agent appears on the QMF bus |
delAgent | agent | an agent disconnects from the QMF bus |
objectProps | broker, object | the properties of an object are published |
objectStats | broker, object | the statistics of an object are published |
event | broker, event | an event is published |
heartbeat | agent, timestamp | a heartbeat is published by an agent |
brokerInfo | broker | information about a connected broker is available to be queried |