@ComponentProfile(summary="Interceptor that issues a JMX notification if a message count threshold is exceeded", tag="interceptor,jmx") public class MessageThresholdNotification extends NotifyingInterceptorByCount
Notification
if the number of messages has exceeded the
specified threshold in the current timeslice.
The Notification.setUserData(Object)
part of the notification is a Properties
object containing information about the various counts that exceeded the interceptors threshold.
Note that notifications are emitted whenever a message is deemed to have exceeded the threshold;
so you will get multiple notifications whenever a message causes the threshold to be exceeded
until the next time-slice is activated.
In the adapter configuration file this class is aliased as message-threshold-notification which is the preferred alternative to the fully qualified classname when building your configuration.
WorkflowInterceptorImpl.WorkflowInterceptorException
KEY_MESSAGE_COUNT, KEY_MESSAGE_ERROR, KEY_MESSAGE_SIZE, KEY_TIMESLICE_END, KEY_TIMESLICE_START
log
Constructor and Description |
---|
MessageThresholdNotification() |
MessageThresholdNotification(java.lang.String uid) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the component.
|
java.lang.Long |
getCountThreshold() |
java.lang.Long |
getErrorThreshold() |
java.lang.Long |
getSizeThreshold() |
void |
init()
Initialises the component.
|
void |
setCountThreshold(java.lang.Long l)
Set the message count threshold on which notifications will be emitted.
|
void |
setErrorThreshold(java.lang.Long l)
Set the message error count threshold on which notifications will be emitted.
|
void |
setSizeThreshold(java.lang.Long l)
Set the total message size threshold (in bytes) on which notifications will be emitted.
|
void |
start()
Starts the component.
|
void |
stop()
Stop the component
|
void |
workflowEnd(AdaptrisMessage inputMsg,
AdaptrisMessage outputMsg)
Mark the end of a workflow.
|
void |
workflowStart(AdaptrisMessage inputMsg)
Mark the start of a workflow.
|
asProperties, getAndIncrementStatistic, getCurrentTimeSlice, getTimesliceDuration, setTimesliceDuration
changeState, getUniqueId, parentChannel, parentWorkflow, prepare, registerParentChannel, registerParentWorkflow, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setUniqueId, wasSuccessful
public MessageThresholdNotification()
public MessageThresholdNotification(java.lang.String uid)
public void workflowStart(AdaptrisMessage inputMsg)
WorkflowInterceptor
inputMsg
- the message that will be processed by this workflow.public void workflowEnd(AdaptrisMessage inputMsg, AdaptrisMessage outputMsg)
WorkflowInterceptor
inputMsg
- the original message that was originally submitted to the workflow; in the event of an exception during
processing, the exception will be stored in object metadata in the inputMsgoutputMsg
- the message contaning any changes that may have been applied by the services within the workflow.CoreConstants.OBJ_METADATA_EXCEPTION
public void init() throws CoreException
ComponentLifecycle
Component initialisation includes config verification, creation of connections etc.
CoreException
- wrapping any underlying Exception
spublic void start() throws CoreException
ComponentLifecycle
Once a component is started it should be ready to process messages. In the case of
AdaptrisMessageConsumer
, calling start will begin message delivery.
CoreException
- wrapping any underlying Exception
spublic void stop()
ComponentLifecycle
A stopped component is not expected to be ready to process messages. In the case of
AdaptrisMessageConsumer
, calling stop will pause message delivery. Throwing a
RuntimeException
may cause unintended consequences
public void close()
ComponentLifecycle
A closed component should release any connections it uses, etc. and clean up completely.
Throwing a RuntimeException
may cause unintended consequences
public java.lang.Long getCountThreshold()
public void setCountThreshold(java.lang.Long l)
l
- the threshold, defaults to null which means no notification on this metricpublic java.lang.Long getErrorThreshold()
public void setErrorThreshold(java.lang.Long l)
l
- the threshold, defaults to null which means no notifications on metric.public java.lang.Long getSizeThreshold()
public void setSizeThreshold(java.lang.Long l)
l
- the threshold, defaults to null which means no notifications on metric.