Interface EventNotifier
public interface EventNotifier
Observer that receives
CamelEvent notifications fired by the Camel runtime.
Notifiers are registered with ManagementStrategy.addEventNotifier(EventNotifier) and receive every event that
ManagementStrategy.notify(CamelEvent) dispatches. Common uses include emitting metrics (Micrometer,
Prometheus), publishing traces, audit logging, and driving test assertions.
Each event category can be selectively suppressed via the setIgnore* methods, which avoids the overhead of
dispatching events that the notifier does not care about. For example, a metrics-only notifier can ignore all route
lifecycle events while still observing exchange sent/completed events. The EventFactory is the counterpart
that constructs the actual event objects.
See Event Notifier in the Camel user manual.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks whether notification is disabled for all eventsbooleanisEnabled(CamelEvent event) Checks whether notification for the given event is enabled.booleanWhether to ignore CamelContext lifecycle events (start, stop, suspend, resume).booleanWhether to ignore CamelContext initialization events.booleanDeprecated.Whether to ignore exchange async processing started events.booleanWhether to ignore exchange completed events.booleanWhether to ignore exchange created events.booleanWhether to ignore all exchange events.booleanWhether to ignore exchange failed events.booleanWhether to ignore exchange redelivery events.booleanWhether to ignore exchange sending events (before sending to an endpoint).booleanWhether to ignore exchange sent events (after sending to an endpoint).booleanWhether to ignore route lifecycle events (added, removed, started, stopped).booleanWhether to ignore service lifecycle events (start failure, stop failure).booleanWhether to ignore step events.voidnotify(CamelEvent event) Notifies the given eventvoidsetIgnoreCamelContextEvents(boolean ignoreCamelContextEvents) Set whether to ignore CamelContext lifecycle events (start, stop, suspend, resume).voidsetIgnoreCamelContextInitEvents(boolean ignoreCamelContextInitEvents) Set whether to ignore CamelContext initialization events.voidsetIgnoreExchangeAsyncProcessingStartedEvents(boolean ignoreExchangeAsyncProcessingStartedEvents) Deprecated.Set whether to ignore exchange async processing started events.voidsetIgnoreExchangeCompletedEvent(boolean ignoreExchangeCompletedEvent) Set whether to ignore exchange completed events.voidsetIgnoreExchangeCreatedEvent(boolean ignoreExchangeCreatedEvent) Set whether to ignore exchange created events.voidsetIgnoreExchangeEvents(boolean ignoreExchangeEvents) Set whether to ignore all exchange events.voidsetIgnoreExchangeFailedEvents(boolean ignoreExchangeFailureEvents) Set whether to ignore exchange failed events.voidsetIgnoreExchangeRedeliveryEvents(boolean ignoreExchangeRedeliveryEvents) Set whether to ignore exchange redelivery events.voidsetIgnoreExchangeSendingEvents(boolean ignoreExchangeSendingEvents) Set whether to ignore exchange sending events (before sending to an endpoint).voidsetIgnoreExchangeSentEvents(boolean ignoreExchangeSentEvents) Set whether to ignore exchange sent events (after sending to an endpoint).voidsetIgnoreRouteEvents(boolean ignoreRouteEvents) Set whether to ignore route lifecycle events (added, removed, started, stopped).voidsetIgnoreServiceEvents(boolean ignoreServiceEvents) Set whether to ignore service lifecycle events (start failure, stop failure).voidsetIgnoreStepEvents(boolean ignoreStepEvents) Set whether to ignore step events.
-
Method Details
-
notify
Notifies the given event- Parameters:
event- the event- Throws:
Exception- can be thrown if notification failed
-
isEnabled
Checks whether notification for the given event is enabled. If disabled the event will not be sent and silently ignored instead.- Parameters:
event- the event- Returns:
- true if the event should be sent, false to silently ignore it
-
isDisabled
boolean isDisabled()Checks whether notification is disabled for all events- Returns:
- true if disabled and no events is being notified.
-
isIgnoreCamelContextInitEvents
boolean isIgnoreCamelContextInitEvents()Whether to ignore CamelContext initialization events. -
setIgnoreCamelContextInitEvents
void setIgnoreCamelContextInitEvents(boolean ignoreCamelContextInitEvents) Set whether to ignore CamelContext initialization events. -
isIgnoreCamelContextEvents
boolean isIgnoreCamelContextEvents()Whether to ignore CamelContext lifecycle events (start, stop, suspend, resume). -
setIgnoreCamelContextEvents
void setIgnoreCamelContextEvents(boolean ignoreCamelContextEvents) Set whether to ignore CamelContext lifecycle events (start, stop, suspend, resume). -
isIgnoreRouteEvents
boolean isIgnoreRouteEvents()Whether to ignore route lifecycle events (added, removed, started, stopped). -
setIgnoreRouteEvents
void setIgnoreRouteEvents(boolean ignoreRouteEvents) Set whether to ignore route lifecycle events (added, removed, started, stopped). -
isIgnoreServiceEvents
boolean isIgnoreServiceEvents()Whether to ignore service lifecycle events (start failure, stop failure). -
setIgnoreServiceEvents
void setIgnoreServiceEvents(boolean ignoreServiceEvents) Set whether to ignore service lifecycle events (start failure, stop failure). -
isIgnoreExchangeEvents
boolean isIgnoreExchangeEvents()Whether to ignore all exchange events. -
setIgnoreExchangeEvents
void setIgnoreExchangeEvents(boolean ignoreExchangeEvents) Set whether to ignore all exchange events. -
isIgnoreExchangeCreatedEvent
boolean isIgnoreExchangeCreatedEvent()Whether to ignore exchange created events. -
setIgnoreExchangeCreatedEvent
void setIgnoreExchangeCreatedEvent(boolean ignoreExchangeCreatedEvent) Set whether to ignore exchange created events. -
isIgnoreExchangeCompletedEvent
boolean isIgnoreExchangeCompletedEvent()Whether to ignore exchange completed events. -
setIgnoreExchangeCompletedEvent
void setIgnoreExchangeCompletedEvent(boolean ignoreExchangeCompletedEvent) Set whether to ignore exchange completed events. -
isIgnoreExchangeFailedEvents
boolean isIgnoreExchangeFailedEvents()Whether to ignore exchange failed events. -
setIgnoreExchangeFailedEvents
void setIgnoreExchangeFailedEvents(boolean ignoreExchangeFailureEvents) Set whether to ignore exchange failed events. -
isIgnoreExchangeRedeliveryEvents
boolean isIgnoreExchangeRedeliveryEvents()Whether to ignore exchange redelivery events. -
setIgnoreExchangeRedeliveryEvents
void setIgnoreExchangeRedeliveryEvents(boolean ignoreExchangeRedeliveryEvents) Set whether to ignore exchange redelivery events. -
isIgnoreExchangeSentEvents
boolean isIgnoreExchangeSentEvents()Whether to ignore exchange sent events (after sending to an endpoint). -
setIgnoreExchangeSentEvents
void setIgnoreExchangeSentEvents(boolean ignoreExchangeSentEvents) Set whether to ignore exchange sent events (after sending to an endpoint). -
isIgnoreExchangeSendingEvents
boolean isIgnoreExchangeSendingEvents()Whether to ignore exchange sending events (before sending to an endpoint). -
setIgnoreExchangeSendingEvents
void setIgnoreExchangeSendingEvents(boolean ignoreExchangeSendingEvents) Set whether to ignore exchange sending events (before sending to an endpoint). -
isIgnoreStepEvents
boolean isIgnoreStepEvents()Whether to ignore step events. -
setIgnoreStepEvents
void setIgnoreStepEvents(boolean ignoreStepEvents) Set whether to ignore step events. -
setIgnoreExchangeAsyncProcessingStartedEvents
@Deprecated(since="4.19.0") void setIgnoreExchangeAsyncProcessingStartedEvents(boolean ignoreExchangeAsyncProcessingStartedEvents) Deprecated.Set whether to ignore exchange async processing started events. -
isIgnoreExchangeAsyncProcessingStartedEvents
Deprecated.Whether to ignore exchange async processing started events.
-