use of org.apache.camel.spi.EventFactory in project camel by apache.
the class EventHelper method notifyRouteStopped.
public static void notifyRouteStopped(CamelContext context, Route route) {
ManagementStrategy management = context.getManagementStrategy();
if (management == null) {
return;
}
List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
for (EventNotifier notifier : notifiers) {
if (notifier.isIgnoreRouteEvents()) {
continue;
}
EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
EventObject event = factory.createRouteStoppedEvent(route);
if (event == null) {
return;
}
doNotifyEvent(notifier, event);
}
}
use of org.apache.camel.spi.EventFactory in project camel by apache.
the class EventHelper method notifyServiceStopFailure.
public static void notifyServiceStopFailure(CamelContext context, Object service, Throwable cause) {
ManagementStrategy management = context.getManagementStrategy();
if (management == null) {
return;
}
List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
for (EventNotifier notifier : notifiers) {
if (notifier.isIgnoreServiceEvents()) {
continue;
}
EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
EventObject event = factory.createServiceStopFailureEvent(context, service, cause);
if (event == null) {
return;
}
doNotifyEvent(notifier, event);
}
}
use of org.apache.camel.spi.EventFactory in project camel by apache.
the class EventHelper method notifyCamelContextSuspended.
public static void notifyCamelContextSuspended(CamelContext context) {
ManagementStrategy management = context.getManagementStrategy();
if (management == null) {
return;
}
List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
for (EventNotifier notifier : notifiers) {
if (notifier.isIgnoreCamelContextEvents()) {
continue;
}
EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
EventObject event = factory.createCamelContextSuspendedEvent(context);
if (event == null) {
return;
}
doNotifyEvent(notifier, event);
}
}
use of org.apache.camel.spi.EventFactory in project camel by apache.
the class EventHelper method notifyExchangeFailureHandling.
public static void notifyExchangeFailureHandling(CamelContext context, Exchange exchange, Processor failureHandler, boolean deadLetterChannel, String deadLetterUri) {
if (exchange.getProperty(Exchange.NOTIFY_EVENT, false, Boolean.class)) {
// do not generate events for an notify event
return;
}
ManagementStrategy management = context.getManagementStrategy();
if (management == null) {
return;
}
List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
for (EventNotifier notifier : notifiers) {
if (notifier.isIgnoreExchangeEvents() || notifier.isIgnoreExchangeFailedEvents()) {
continue;
}
EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
EventObject event = factory.createExchangeFailureHandlingEvent(exchange, failureHandler, deadLetterChannel, deadLetterUri);
if (event == null) {
return;
}
doNotifyEvent(notifier, event);
}
}
use of org.apache.camel.spi.EventFactory in project camel by apache.
the class EventHelper method notifyExchangeDone.
public static void notifyExchangeDone(CamelContext context, Exchange exchange) {
if (exchange.getProperty(Exchange.NOTIFY_EVENT, false, Boolean.class)) {
// do not generate events for an notify event
return;
}
ManagementStrategy management = context.getManagementStrategy();
if (management == null) {
return;
}
List<EventNotifier> notifiers = management.getEventNotifiers();
if (notifiers == null || notifiers.isEmpty()) {
return;
}
for (EventNotifier notifier : notifiers) {
if (notifier.isIgnoreExchangeEvents() || notifier.isIgnoreExchangeCompletedEvent()) {
continue;
}
EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
EventObject event = factory.createExchangeCompletedEvent(exchange);
if (event == null) {
return;
}
doNotifyEvent(notifier, event);
}
}
Aggregations