Search in sources :

Example 6 with EventNotifierSupport

use of org.apache.camel.support.EventNotifierSupport in project camel by apache.

the class UnitOfWorkProducerTest method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    DefaultCamelContext context = new DefaultCamelContext(createRegistry());
    context.getManagementStrategy().addEventNotifier(new EventNotifierSupport() {

        public void notify(EventObject event) throws Exception {
            events.add(event);
        }

        public boolean isEnabled(EventObject event) {
            return event instanceof ExchangeCompletedEvent;
        }

        @Override
        protected void doStart() throws Exception {
        }

        @Override
        protected void doStop() throws Exception {
        }
    });
    return context;
}
Also used : EventNotifierSupport(org.apache.camel.support.EventNotifierSupport) ExchangeCompletedEvent(org.apache.camel.management.event.ExchangeCompletedEvent) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) EventObject(java.util.EventObject)

Example 7 with EventNotifierSupport

use of org.apache.camel.support.EventNotifierSupport in project camel by apache.

the class EventNotifierFailureHandledEventsTest method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    DefaultCamelContext context = new DefaultCamelContext(createRegistry());
    context.getManagementStrategy().addEventNotifier(new EventNotifierSupport() {

        public void notify(EventObject event) throws Exception {
            events.add(event);
        }

        public boolean isEnabled(EventObject event) {
            return true;
        }

        @Override
        protected void doStart() throws Exception {
        }

        @Override
        protected void doStop() throws Exception {
        }
    });
    return context;
}
Also used : EventNotifierSupport(org.apache.camel.support.EventNotifierSupport) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) EventObject(java.util.EventObject)

Example 8 with EventNotifierSupport

use of org.apache.camel.support.EventNotifierSupport in project camel by apache.

the class EventNotifierRedeliveryEventsTest method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    DefaultCamelContext context = new DefaultCamelContext(createRegistry());
    context.getManagementStrategy().addEventNotifier(new EventNotifierSupport() {

        public void notify(EventObject event) throws Exception {
            events.add(event);
        }

        public boolean isEnabled(EventObject event) {
            return true;
        }

        @Override
        protected void doStart() throws Exception {
            setIgnoreCamelContextEvents(true);
            setIgnoreRouteEvents(true);
            setIgnoreServiceEvents(true);
        }

        @Override
        protected void doStop() throws Exception {
        }
    });
    return context;
}
Also used : EventNotifierSupport(org.apache.camel.support.EventNotifierSupport) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) EventObject(java.util.EventObject)

Example 9 with EventNotifierSupport

use of org.apache.camel.support.EventNotifierSupport in project camel by apache.

the class EventNotifierServiceStoppingFailedEventTest method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext context = super.createCamelContext();
    context.addService(new MyService("A", false));
    context.addService(new MyService("B", true));
    context.addService(new MyService("C", false));
    context.getManagementStrategy().addEventNotifier(new EventNotifierSupport() {

        public void notify(EventObject event) throws Exception {
            events.add(event);
        }

        public boolean isEnabled(EventObject event) {
            return true;
        }

        @Override
        protected void doStart() throws Exception {
        }

        @Override
        protected void doStop() throws Exception {
        }
    });
    return context;
}
Also used : CamelContext(org.apache.camel.CamelContext) EventNotifierSupport(org.apache.camel.support.EventNotifierSupport) EventObject(java.util.EventObject)

Example 10 with EventNotifierSupport

use of org.apache.camel.support.EventNotifierSupport in project camel by apache.

the class EventNotifierEventsTest method createCamelContext.

@Override
protected CamelContext createCamelContext() throws Exception {
    DefaultCamelContext context = new DefaultCamelContext(createRegistry());
    context.getManagementStrategy().addEventNotifier(new EventNotifierSupport() {

        public void notify(EventObject event) throws Exception {
            events.add(event);
        }

        public boolean isEnabled(EventObject event) {
            return true;
        }

        @Override
        protected void doStart() throws Exception {
        }

        @Override
        protected void doStop() throws Exception {
        }
    });
    return context;
}
Also used : EventNotifierSupport(org.apache.camel.support.EventNotifierSupport) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) EventObject(java.util.EventObject)

Aggregations

EventObject (java.util.EventObject)15 EventNotifierSupport (org.apache.camel.support.EventNotifierSupport)15 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)10 File (java.io.File)2 CountDownLatch (java.util.concurrent.CountDownLatch)2 ExchangeCompletedEvent (org.apache.camel.management.event.ExchangeCompletedEvent)2 ExchangeSentEvent (org.apache.camel.management.event.ExchangeSentEvent)2 RouteAddedEvent (org.apache.camel.management.event.RouteAddedEvent)2 CamelContext (org.apache.camel.CamelContext)1 RouteBuilder (org.apache.camel.builder.RouteBuilder)1 ExchangeSendingEvent (org.apache.camel.management.event.ExchangeSendingEvent)1