Package org.apache.camel.spi
Interface ManagementStrategy
-
- All Superinterfaces:
AutoCloseable,Service,StaticService
public interface ManagementStrategy extends StaticService
Strategy for management. If JMX is detected (camel-management JAR on the classpath) then org.apache.camel.management.JmxManagementStrategy is in use. Otherwise, the DefaultManagementStrategy is in use. You can also plugin and use a 3rd party management implementation with Camel.- See Also:
EventNotifier,EventFactory
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddEventNotifier(EventNotifier eventNotifier)Adds the event notifier to use.EventFactorygetEventFactory()Gets the event factoryList<EventNotifier>getEventNotifiers()Gets the event notifiers.ManagementAgentgetManagementAgent()Gets the management agentManagementObjectNameStrategygetManagementObjectNameStrategy()Gets the naming strategy to useManagementObjectStrategygetManagementObjectStrategy()Gets the object strategy to useList<EventNotifier>getStartedEventNotifiers()Gets all the started event notifiers, which is ready to be used.booleanisManaged(Object managedObject)Determines 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 usevoidsetManagementObjectNameStrategy(ManagementObjectNameStrategy strategy)Sets the naming strategy to usevoidsetManagementObjectStrategy(ManagementObjectStrategy strategy)Sets the object strategy to usevoidunmanageObject(Object managedObject)Removes the managed object.
-
-
-
Method Detail
-
manageObject
void manageObject(Object managedObject) throws Exception
Adds a managed object allowing the ManagementStrategy implementation to record or expose the object as it sees fit.- Parameters:
managedObject- the managed object- Throws:
Exception- can be thrown if the object could not be added
-
unmanageObject
void unmanageObject(Object managedObject) throws Exception
Removes the managed object.- Parameters:
managedObject- the managed object- Throws:
Exception- can be thrown if the object could not be removed
-
isManaged
boolean isManaged(Object managedObject)
Determines if an object or name is managed.- Parameters:
managedObject- the object to consider- Returns:
- true if the given object is managed
-
isManagedName
boolean isManagedName(Object name)
Determines if an object or name is managed.- Parameters:
name- the name to consider- Returns:
- true if the given name is managed
-
notify
void notify(CamelEvent event) throws Exception
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
List<EventNotifier> getEventNotifiers()
Gets the event notifiers.- Returns:
- event notifiers
-
getStartedEventNotifiers
List<EventNotifier> getStartedEventNotifiers()
Gets all the started event notifiers, which is ready to be used.- Returns:
- started event notifiers
-
addEventNotifier
void addEventNotifier(EventNotifier eventNotifier)
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
boolean removeEventNotifier(EventNotifier eventNotifier)
Removes the event notifier- Parameters:
eventNotifier- event notifier to remove- Returns:
- true if removed, false if already removed
-
getEventFactory
EventFactory getEventFactory()
Gets the event factory- Returns:
- event factory
-
setEventFactory
void setEventFactory(EventFactory eventFactory)
Sets the event factory to use- Parameters:
eventFactory- event factory
-
getManagementObjectNameStrategy
ManagementObjectNameStrategy getManagementObjectNameStrategy()
Gets the naming strategy to use- Returns:
- naming strategy
-
setManagementObjectNameStrategy
void setManagementObjectNameStrategy(ManagementObjectNameStrategy strategy)
Sets the naming strategy to use- Parameters:
strategy- naming strategy
-
getManagementObjectStrategy
ManagementObjectStrategy getManagementObjectStrategy()
Gets the object strategy to use- Returns:
- object strategy
-
setManagementObjectStrategy
void setManagementObjectStrategy(ManagementObjectStrategy strategy)
Sets the object strategy to use- Parameters:
strategy- object strategy
-
getManagementAgent
ManagementAgent getManagementAgent()
Gets the management agent- Returns:
- management agent
-
setManagementAgent
void setManagementAgent(ManagementAgent managementAgent)
Sets the management agent to use- Parameters:
managementAgent- management agent
-
manageProcessor
boolean manageProcessor(NamedNode definition)
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
-
-