Interface ManagementStrategy
- All Superinterfaces:
AutoCloseable, Service, StaticService
Top-level SPI for Camel's management and observability layer, coordinating JMX registration, lifecycle events, and
statistics collection across all Camel artifacts.
When the
camel-management JAR is on the classpath, JmxManagementStrategy is activated and delegates
MBean registration to a ManagementAgent. Without that JAR, DefaultManagementStrategy is used, which
still dispatches lifecycle events to registered EventNotifiers but does not expose JMX MBeans.
The strategy is the central hub for two concerns: management objects (registering and unregistering Camel components,
routes, processors, etc. as MBeans via ManagementObjectStrategy and ManagementObjectNameStrategy) and
events (delivering CamelEvent notifications to all registered EventNotifiers via
notify(CamelEvent)). A third-party management backend can be plugged in by implementing this interface and
providing a ManagementStrategyFactory.
See JMX in the Camel user manual.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddEventNotifier(EventNotifier eventNotifier) Adds the event notifier to use.Gets the event factoryGets the event notifiers.Gets the management agentGets the naming strategy to useGets the object strategy to useGets all the started event notifiers, which is ready to be used.booleanDetermines if an object or name is managed.booleanisManagedName(Object name) Determines if an object or name is managed.voidmanageObject(Object managedObject) Adds a managed object allowing the ManagementStrategy implementation to record or expose the object as it sees fit.booleanmanageProcessor(NamedNode definition) Filter whether the processor should be managed or not.voidnotify(CamelEvent event) Management events provide a single model for capturing information about execution points in the application code.booleanremoveEventNotifier(EventNotifier eventNotifier) Removes the event notifiervoidsetEventFactory(EventFactory eventFactory) Sets the event factory to usevoidsetManagementAgent(ManagementAgent managementAgent) Sets the management agent to usevoidSets the naming strategy to usevoidSets the object strategy to usevoidunmanageObject(Object managedObject) Removes the managed object.
-
Method Details
-
manageObject
-
unmanageObject
-
isManaged
Determines if an object or name is managed.- Parameters:
managedObject- the object to consider- Returns:
- true if the given object is managed
-
isManagedName
Determines if an object or name is managed.- Parameters:
name- the name to consider- Returns:
- true if the given name is managed
-
notify
Management events provide a single model for capturing information about execution points in the application code. Management strategy implementations decide if and where to record these events. Applications communicate events to management strategy implementations via the notify(EventObject) method.- Parameters:
event- the event- Throws:
Exception- can be thrown if the notification failed
-
getEventNotifiers
-
getStartedEventNotifiers
List<EventNotifier> getStartedEventNotifiers()Gets all the started event notifiers, which is ready to be used.- Returns:
- started event notifiers
-
addEventNotifier
Adds the event notifier to use. Ensure the event notifier has been started if its aService, as otherwise it would not be used.- Parameters:
eventNotifier- event notifier
-
removeEventNotifier
Removes the event notifier- Parameters:
eventNotifier- event notifier to remove- Returns:
- true if removed, false if already removed
-
getEventFactory
-
setEventFactory
Sets the event factory to use- Parameters:
eventFactory- event factory
-
getManagementObjectNameStrategy
ManagementObjectNameStrategy getManagementObjectNameStrategy()Gets the naming strategy to use- Returns:
- naming strategy
-
setManagementObjectNameStrategy
Sets the naming strategy to use- Parameters:
strategy- naming strategy
-
getManagementObjectStrategy
ManagementObjectStrategy getManagementObjectStrategy()Gets the object strategy to use- Returns:
- object strategy
-
setManagementObjectStrategy
Sets the object strategy to use- Parameters:
strategy- object strategy
-
getManagementAgent
-
setManagementAgent
Sets the management agent to use- Parameters:
managementAgent- management agent
-
manageProcessor
Filter whether the processor should be managed or not. Is used to filter out unwanted processors to avoid managing at too fine grained level.- Parameters:
definition- definition of the processor- Returns:
- true to manage it
-