use of org.apache.camel.spi.ManagementStrategy 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.ManagementStrategy 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);
}
}
use of org.apache.camel.spi.ManagementStrategy in project camel by apache.
the class EventHelper method notifyCamelContextResumed.
public static void notifyCamelContextResumed(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.createCamelContextResumedEvent(context);
if (event == null) {
return;
}
doNotifyEvent(notifier, event);
}
}
use of org.apache.camel.spi.ManagementStrategy in project camel by apache.
the class EventHelper method notifyCamelContextResumeFailed.
public static void notifyCamelContextResumeFailed(CamelContext context, 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.isIgnoreCamelContextEvents()) {
continue;
}
EventFactory factory = management.getEventFactory();
if (factory == null) {
return;
}
EventObject event = factory.createCamelContextResumeFailureEvent(context, cause);
if (event == null) {
return;
}
doNotifyEvent(notifier, event);
}
}
use of org.apache.camel.spi.ManagementStrategy in project camel by apache.
the class JettyHttpComponent method getMbContainer.
public synchronized MBeanContainer getMbContainer() {
// If null, provide the default implementation.
if (mbContainer == null) {
MBeanServer mbs = null;
final ManagementStrategy mStrategy = this.getCamelContext().getManagementStrategy();
final ManagementAgent mAgent = mStrategy.getManagementAgent();
if (mAgent != null) {
mbs = mAgent.getMBeanServer();
}
if (mbs != null) {
mbContainer = new MBeanContainer(mbs);
startMbContainer();
} else {
LOG.warn("JMX disabled in CamelContext. Jetty JMX extensions will remain disabled.");
}
}
return this.mbContainer;
}
Aggregations