Spring Integration also provides support for inbound and outbound ApplicationEvents
.
To receive events and send to a channel, simply define an instance of Spring Integration's
ApplicationEventListeningChannelAdapter
. This class is an implementation of 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
, create an instance of the
ApplicationEventPublishingMessageHandler
and register it within an endpoint. This
implementation of the MessageHandler
interface also implements Spring's
ApplicationEventPublisherAware
interface and thus acts as a bridge between
Spring Integration Messages and ApplicationEvents
.