To use this event, the composite to subscribe to this event or use this event for publishing. Using this event can be defined in the mediator.
The mediator can me subsribed to this event or publish an event.
Thinking more in this event behaviour, what is the purpose? Before the 11g release we act on 'events' via queues (AQ / JMS) or via database (Polling) of file system. So why should we use it? This question I was asking myself.... and I found the answer. Apart of the event definition language (EDL) , standardization etc, there is a good reason to use this mechanism by default in your SCA applications.
Think about the next 'old' business flow, simplified. In this example 2 systems deliver data to the application. This data is handled in the BPEL process in chich the data is enriched, checked and transformed to a canonical data format. Then the message is put on the message bus and routed further.
With event driven architecture, we can make service independent of each other, guaranteed delivered and are decoupled. But the biggest advantage is that we are able to add composites that need to be handled without touching the other composite.
This is the EventProvider, simplied, it accepts a message that message is passed as an event to SOA 11g Server.
This is the EventHandler, it is subscribed to an event, then the payload is extracted and send to the files adpater (example).
If we need to add another composite, we do not need to add an routing rule, we just add the composite, transform the message and send this event to the SOA 11g Server. There is no direct routing between the EventProvider and the EventHandler! It is decoupled!
An example of this code can be downloaded here.
So how does it works? The provider composites and the event-handler composite must have an identical event definition. These definitions must be the same;
Even definition name Event name Event message
Note: If different composite are subscribed to the same event, all this composites will be triggered and an composite instance is created.