OpenHub uses Apache Camel events concept:
- all Camel events extend java.util.EventObject resp. org.apache.camel.management.event.AbstractExchangeEvent. There are many events already defined in Camel, e.g. ExchangeCompletedEvent, ExchangeFailedEvent, ExchangeSendingEvent etc. These events are generated automatically by Camel.
- if you want to catch these events then you have to implement EventNotifier interface and this notifier add to Camel context. It's possible to use method addEventNotifier in class AbstractBasicRoute for our routes.
Usage example: EventNotifier to log details about all sent Exchanges
There are new events defined in OpenHub framework which can be caught anywhere by EventNotifier:
There is @EventNotifier annotation that marks classes which implement org.apache.camel.spi.EventNotifier interface for listening to Camel events.
EventNotifier implementations have special behaviour in Camel, most of them are Camel services with well-defined lifecycle. Use parent class EventNotifierBase to meet these requirements.
Event throwing, method notifyFailedFromVf: