@ComponentProfile(summary="Listen for notifications against the specified ObjectName", tag="consumer,jmx", metadata="jmxNotificationSource", recommended=JmxConnection.class) public class JmxNotificationConsumer extends AdaptrisMessageConsumerImp implements javax.management.NotificationListener
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
JMX_NOTIF_SOURCE |
log
Constructor and Description |
---|
JmxNotificationConsumer() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the component.
|
java.lang.String |
consumeLocationKey()
Provides the metadata key '"jmxNotificationSource"' that contains the source of the
notifcation.
|
ConsumeDestination |
getDestination()
Deprecated.
|
java.lang.Boolean |
getFailIfNotFound() |
java.lang.String |
getObjectName()
The object name which we will register as a listener for.
|
NotificationSerializer |
getSerializer() |
void |
handleNotification(javax.management.Notification notification,
java.lang.Object handback) |
void |
init()
Initialises the component.
|
protected java.lang.String |
newThreadName() |
protected java.lang.String |
objectName() |
void |
prepare()
Prepare for initialisation.
|
void |
setDestination(ConsumeDestination destination)
Deprecated.
|
void |
setFailIfNotFound(java.lang.Boolean b)
Whether or not to fail if the ObjectName is not found.
|
void |
setObjectName(java.lang.String objectName)
The object name which we will register as a listener for.
|
void |
setSerializer(NotificationSerializer serializer) |
void |
start()
Starts the component.
|
void |
stop()
Stop the component
|
changeState, registerAdaptrisMessageListener, renameThread, requestClose, requestInit, requestStart, requestStop, retrieveAdaptrisMessageListener, retrieveComponentState
createName, createQualifier, decode, encode, getEncoder, getIsTrackingEndpoint, getMessageFactory, getUniqueId, handleConnectionException, isTrackingEndpoint, registerConnection, registerEncoderMessageFactory, retrieveConnection, setEncoder, setIsTrackingEndpoint, setMessageFactory, setUniqueId, withMessageFactory, withUniqueID
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
decode, encode, getEncoder, getMessageFactory, handleConnectionException, registerConnection, retrieveConnection, setEncoder, setMessageFactory
getUniqueId
createName, createQualifier, isTrackingEndpoint
public static final java.lang.String JMX_NOTIF_SOURCE
protected java.lang.String objectName()
protected java.lang.String newThreadName()
newThreadName
in class AdaptrisMessageConsumerImp
public void prepare() throws CoreException
ComponentLifecycleExtension
prepare
in interface ComponentLifecycleExtension
CoreException
public void init() throws CoreException
ComponentLifecycle
Component initialisation includes config verification, creation of connections etc.
init
in interface ComponentLifecycle
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.
start
in interface ComponentLifecycle
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
stop
in interface ComponentLifecycle
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
close
in interface ComponentLifecycle
public NotificationSerializer getSerializer()
public void setSerializer(NotificationSerializer serializer)
serializer
- the serializer to setpublic void handleNotification(javax.management.Notification notification, java.lang.Object handback)
handleNotification
in interface javax.management.NotificationListener
public java.lang.Boolean getFailIfNotFound()
public void setFailIfNotFound(java.lang.Boolean b)
If set to false, and the object is not found, then an attempt will be made periodically to check the MBeanServeConnection for the object instance availability; when it becomes available, the notificaiton listener will be added at that point.
b
- the failIfNotFound to set, default is truepublic java.lang.String consumeLocationKey()
consumeLocationKey
in interface AdaptrisMessageConsumer
@Deprecated public ConsumeDestination getDestination()
@Deprecated public void setDestination(ConsumeDestination destination)
public java.lang.String getObjectName()
public void setObjectName(java.lang.String objectName)