org.apache.camel.component.jmx
Class JMXConsumer
java.lang.Object
org.apache.camel.support.ServiceSupport
org.apache.camel.impl.DefaultConsumer
org.apache.camel.component.jmx.JMXConsumer
- All Implemented Interfaces:
- EventListener, NotificationListener, org.apache.camel.Consumer, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.StatefulService, org.apache.camel.SuspendableService
- Direct Known Subclasses:
- JMXMonitorConsumer
public class JMXConsumer
- extends org.apache.camel.impl.DefaultConsumer
- implements NotificationListener
Consumer will add itself as a NotificationListener on the object
specified by the objectName param.
Fields inherited from class org.apache.camel.impl.DefaultConsumer |
log |
Fields inherited from class org.apache.camel.support.ServiceSupport |
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending |
Methods inherited from class org.apache.camel.impl.DefaultConsumer |
getAsyncProcessor, getEndpoint, getExceptionHandler, getProcessor, handleException, handleException, setExceptionHandler, toString |
Methods inherited from class org.apache.camel.support.ServiceSupport |
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, resume, shutdown, start, stop, suspend |
Methods inherited from interface org.apache.camel.Service |
start, stop |
JMXConsumer
public JMXConsumer(JMXEndpoint endpoint,
org.apache.camel.Processor processor)
doStart
protected void doStart()
throws Exception
- Initializes the mbean server connection and starts listening for
Notification events from the object.
- Overrides:
doStart
in class org.apache.camel.impl.DefaultConsumer
- Throws:
Exception
addNotificationListener
protected void addNotificationListener()
throws Exception
- Adds a notification listener to the target bean.
- Throws:
Exception
doStop
protected void doStop()
throws Exception
- Removes the notification listener
- Overrides:
doStop
in class org.apache.camel.impl.DefaultConsumer
- Throws:
Exception
removeNotificationListener
protected void removeNotificationListener()
throws Exception
- Removes the consumer as a listener from the bean.
- Throws:
Exception
getServerConnection
protected MBeanServerConnection getServerConnection()
setServerConnection
protected void setServerConnection(MBeanServerConnection aServerConnection)
handleNotification
public void handleNotification(Notification aNotification,
Object aHandback)
- Processes the Notification received. The handback will be set as
the header "jmx.handback" while the Notification will be set as
the body.
If the format is set to "xml" then the Notification will be converted
to XML first using
NotificationXmlFormatter
- Specified by:
handleNotification
in interface NotificationListener
- See Also:
NotificationListener.handleNotification(javax.management.Notification, java.lang.Object)
getFormatter
protected NotificationXmlFormatter getFormatter()
Apache CAMEL