Monitoring correlator-integrated messaging for JMS status
Apama applications often need to monitor the status of JMS connections, senders, and receivers when the application needs to wait for a receiver or sender to be available (status “OK
”) before using it, and, conversely, to detect and report error conditions.
The main way to monitor status is to simply set up EPL listeners for the JMSConnectionStatus
, JMSReceiverStatus
, and JMSSenderStatus
events which are sent to all public correlator contexts automatically, both on startup and whenever the status of these items changes. Note that there is no need to ‘subscribe’ to receive these events — provided JMS.onApplicationInitialized()
was called, these events will be sent automatically, so all that is required is to set up listeners.
Occasionally, it may be useful to monitor status using the standardized event API defined by StatusSupport.mon
. The CorrelatorJMSStatusManager
monitor, which is part of the correlator-integrated messaging for JMS bundle, acts as a bridge between the JMS-specific status events and this API, to allow Apama applications to monitor the status of JMS connections, senders and receivers using the standard Status Support interface.
To use this interface
-
Send a
com.apama.statusreport.SubscribeStatus
event, which is defined as:event SubscribeStatus { string serviceID; string object; string subServiceID; string connection; }
The fields for the
SubscribeStatus
event are:serviceID
- This should be set toCORRELATOR_JMS
.object
- Can beCONNECTION
,RECEIVER
, orSENDER
, or""
(empty string). If""
is specified, the application will subscribe to status events for all connections, receivers, and senders.subServiceID
- The name of a specific receiver or sender ifRECEIVER
orSENDER
is specified in theobject
field. If theobject
field specifiesRECEIVER
orSENDER
, thesubServiceID
field must have a valid, non-empty value. If theobject
field specifiesCONNECTION
this field must be""
.connection
- The name of a specific connection. If theobject
field specifies a value, theconnection
field must have a valid, non-empty value.
-
Create listeners for
com.apama.statusreport.Status
events (and optionally forStatusError
events which are sent if the status subscription failed due to an invalid identifier being specified). -
To unsubscribe, send an
UnsubscribeStatus
event with field values that match the correspondingSubscribeStatus
event.
For more information on monitoring correlator-integrated messaging for JMS connections, receivers, and senders, see the descriptions of the JMSConnectionStatus
, JMSReceiverStatus
, and JMSSenderStatus
events in the ApamaDoc documentation.