3.10 ApplicationEvent Adapters

Spring ApplicationEvents can also be integrated as either a source or target for Spring Integration message channels. To receive the events and send to a channel, simply define an instance of Spring Integration's ApplicationEventSourceAdapter (as with all source adapters, if a MessageBus is defined, it will automatically detect the event source adapter). The ApplicationEventSourceAdapter implements Spring's ApplicationListener interface. By default it will pass all received events as Spring Integration Messages. To limit based on the type of event, configure the list of event types that you want to receive with the 'eventTypes' property.

To send Spring ApplicationEvents, register an instance of the ApplicationEventTargetAdapter class as the handler of an endpoint (such configuration will be described in detail in the section called “Configuring Message Endpoints”). This adapter implements Spring's ApplicationEventPublisherAware interface and thus acts as a bridge between Spring Integration Messages and ApplicationEvents.