Package org.apache.camel.component.jmx
Class JMXConsumer
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.DefaultConsumer
org.apache.camel.component.jmx.JMXConsumer
- All Implemented Interfaces:
AutoCloseable,EventListener,NotificationListener,org.apache.camel.Consumer,org.apache.camel.EndpointAware,org.apache.camel.health.HealthCheckAware,org.apache.camel.RouteAware,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.spi.HostedService,org.apache.camel.spi.RouteIdAware,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
- Direct Known Subclasses:
JMXMonitorConsumer
public class JMXConsumer
extends org.apache.camel.support.DefaultConsumer
implements NotificationListener
Consumer will add itself as a NotificationListener on the object specified by the objectName param.
-
Field Summary
Fields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdds a notification listener to the target bean.protected voiddoStart()Initializes the mbean server connection and starts listening for Notification events from the object.protected voiddoStop()Removes the notification listeners and terminates the background connection polling process if it existsprotected org.apache.camel.component.jmx.JMXConsumer.ConnectionNotificationListenerReturns the connection notification listener; creates the default listener if one does not already existprotected NotificationXmlFormatterprotected MBeanServerConnectionvoidhandleNotification(Notification aNotification, Object aHandback) Processes the Notification received.protected voidRemoves the configured notification listener and the connection notification listener from the connectionprotected voidSchedules execution of the doStart() operation to occur again after the reconnect delayprotected voidSchedules an attempt to re-initialize a lost connection after the reconnect delayprotected voidsetServerConnection(MBeanServerConnection aServerConnection) Methods inherited from class org.apache.camel.support.DefaultConsumer
createExchange, createUoW, defaultConsumerCallback, doBuild, doInit, doneUoW, doShutdown, getAsyncProcessor, getExceptionHandler, getHealthCheck, getProcessor, getRoute, getRouteId, handleException, handleException, handleException, isHostedService, releaseExchange, setExceptionHandler, setHealthCheck, setRoute, setRouteId, toStringMethods inherited from class org.apache.camel.support.service.BaseService
build, doFail, doLifecycleChange, doResume, doSuspend, fail, getInternalLock, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.camel.Service
build, close, init, start, stopMethods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Constructor Details
-
JMXConsumer
-
-
Method Details
-
getEndpoint
- Specified by:
getEndpointin interfaceorg.apache.camel.EndpointAware- Overrides:
getEndpointin classorg.apache.camel.support.DefaultConsumer
-
doStart
Initializes the mbean server connection and starts listening for Notification events from the object.- Overrides:
doStartin classorg.apache.camel.support.DefaultConsumer- Throws:
Exception
-
getConnectionNotificationListener
protected org.apache.camel.component.jmx.JMXConsumer.ConnectionNotificationListener getConnectionNotificationListener()Returns the connection notification listener; creates the default listener if one does not already exist -
scheduleDelayedStart
protected void scheduleDelayedStart()Schedules execution of the doStart() operation to occur again after the reconnect delay -
scheduleReconnect
protected void scheduleReconnect()Schedules an attempt to re-initialize a lost connection after the reconnect delay -
addNotificationListener
Adds a notification listener to the target bean.- Throws:
Exception
-
doStop
Removes the notification listeners and terminates the background connection polling process if it exists- Overrides:
doStopin classorg.apache.camel.support.DefaultConsumer- Throws:
Exception
-
removeNotificationListeners
Removes the configured notification listener and the connection notification listener from the connection- Throws:
Exception
-
getServerConnection
-
setServerConnection
-
handleNotification
Processes the Notification received. The handback will be set as the headerJMXConstants.JMX_HANDBACKwhile the Notification will be set as the body. If the format is set to "xml" then the Notification will be converted to XML first usingNotificationXmlFormatter- Specified by:
handleNotificationin interfaceNotificationListener- See Also:
-
getFormatter
-