Search in sources :

Example 16 with EventFactory

use of org.apache.camel.spi.EventFactory in project camel by apache.

the class EventHelper method notifyCamelContextResuming.

public static void notifyCamelContextResuming(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.createCamelContextResumingEvent(context);
        if (event == null) {
            return;
        }
        doNotifyEvent(notifier, event);
    }
}
Also used : ManagementStrategy(org.apache.camel.spi.ManagementStrategy) EventNotifier(org.apache.camel.spi.EventNotifier) EventFactory(org.apache.camel.spi.EventFactory) EventObject(java.util.EventObject)

Example 17 with EventFactory

use of org.apache.camel.spi.EventFactory in project camel by apache.

the class EventHelper method notifyExchangeFailed.

public static void notifyExchangeFailed(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.isIgnoreExchangeFailedEvents()) {
            continue;
        }
        EventFactory factory = management.getEventFactory();
        if (factory == null) {
            return;
        }
        EventObject event = factory.createExchangeFailedEvent(exchange);
        if (event == null) {
            return;
        }
        doNotifyEvent(notifier, event);
    }
}
Also used : ManagementStrategy(org.apache.camel.spi.ManagementStrategy) EventNotifier(org.apache.camel.spi.EventNotifier) EventFactory(org.apache.camel.spi.EventFactory) EventObject(java.util.EventObject)

Example 18 with EventFactory

use of org.apache.camel.spi.EventFactory in project camel by apache.

the class EventHelper method notifyExchangeFailureHandled.

public static void notifyExchangeFailureHandled(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.createExchangeFailureHandledEvent(exchange, failureHandler, deadLetterChannel, deadLetterUri);
        if (event == null) {
            return;
        }
        doNotifyEvent(notifier, event);
    }
}
Also used : ManagementStrategy(org.apache.camel.spi.ManagementStrategy) EventNotifier(org.apache.camel.spi.EventNotifier) EventFactory(org.apache.camel.spi.EventFactory) EventObject(java.util.EventObject)

Example 19 with EventFactory

use of org.apache.camel.spi.EventFactory in project camel by apache.

the class EventHelper method notifyExchangeCreated.

public static void notifyExchangeCreated(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.isIgnoreExchangeCreatedEvent()) {
            continue;
        }
        EventFactory factory = management.getEventFactory();
        if (factory == null) {
            return;
        }
        EventObject event = factory.createExchangeCreatedEvent(exchange);
        if (event == null) {
            return;
        }
        doNotifyEvent(notifier, event);
    }
}
Also used : ManagementStrategy(org.apache.camel.spi.ManagementStrategy) EventNotifier(org.apache.camel.spi.EventNotifier) EventFactory(org.apache.camel.spi.EventFactory) EventObject(java.util.EventObject)

Example 20 with EventFactory

use of org.apache.camel.spi.EventFactory in project camel by apache.

the class EventHelper method notifyCamelContextStarting.

public static void notifyCamelContextStarting(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.createCamelContextStartingEvent(context);
        if (event == null) {
            return;
        }
        doNotifyEvent(notifier, event);
    }
}
Also used : ManagementStrategy(org.apache.camel.spi.ManagementStrategy) EventNotifier(org.apache.camel.spi.EventNotifier) EventFactory(org.apache.camel.spi.EventFactory) EventObject(java.util.EventObject)

Aggregations

EventFactory (org.apache.camel.spi.EventFactory)27 EventNotifier (org.apache.camel.spi.EventNotifier)27 ManagementStrategy (org.apache.camel.spi.ManagementStrategy)27 EventObject (java.util.EventObject)25 TypeConverters (org.apache.camel.TypeConverters)2 BacklogTracer (org.apache.camel.processor.interceptor.BacklogTracer)2 HandleFault (org.apache.camel.processor.interceptor.HandleFault)2 TraceFormatter (org.apache.camel.processor.interceptor.TraceFormatter)2 Tracer (org.apache.camel.processor.interceptor.Tracer)2 AsyncProcessorAwaitManager (org.apache.camel.spi.AsyncProcessorAwaitManager)2 EndpointStrategy (org.apache.camel.spi.EndpointStrategy)2 InflightRepository (org.apache.camel.spi.InflightRepository)2 InterceptStrategy (org.apache.camel.spi.InterceptStrategy)2 LifecycleStrategy (org.apache.camel.spi.LifecycleStrategy)2 ManagementNamingStrategy (org.apache.camel.spi.ManagementNamingStrategy)2 RoutePolicyFactory (org.apache.camel.spi.RoutePolicyFactory)2 RuntimeEndpointRegistry (org.apache.camel.spi.RuntimeEndpointRegistry)2 ShutdownStrategy (org.apache.camel.spi.ShutdownStrategy)2 UnitOfWorkFactory (org.apache.camel.spi.UnitOfWorkFactory)2 HashMap (java.util.HashMap)1