Oracle 11g SOA Suite – The Event Delivery Network – part 2- Subscribing to and Consuming Business Events

Lucas Jellema 4

Events are an important element of SOA infrastructures. Events carry information between SCA Components – without direct dependencies or interaction between these components. Events are published by components in a fire-and-forget style into the Event Delivery Network. This EDN will make the events available to any subscribers to the event. These subscribers for now are all Mediator components. If no subscribers are found, the event goes nowhere from the EDN. That’s life in an Event Driven Architecture.

The Event Type NewEmployee was introduced in the article Oracle 11g SOA Suite – The Event Delivery Network – Publishing Business Events. This event is published by the ReadNewEmployees Mediator Component:


The payload of the event is defined by the NewEmployee element:

When a new employee document arrives, it is read and processed leading to a database record – as described in the article Oracle 11g SOA Suite – Straightforward Mediator example (employees from file to database) – and it is also turned into a Business Event, as is demonstrated by this audit trail:

We will now create a Mediator Component that will subscribe to this Business Event. Instances of the Mediator Component are created upon consumption of the event.

In the Composite Editor, drag the Mediator Component to the central swimlane. In the Create Mediator dialog, specify the name for the Mediator, choose the Subscribe to Events template and select the NewEmployee event:


Press OK. The Composite editor is displayed:

We will now create a new File Adapter Service that will write a new personnel file for the new employee from the NewEmployee event to the c:\temp\personnelfiles directory.

Let’s quickly walk through the File Adapter Service wizard:






Press Next, Press Finish, Accept  further defaults and press Next and Finish where available.

Wire this File Adapter Service to the ConsumeNewEmployeeEvent Mediator Component. Then double click the Mediator Component, expand the Routing Rule and click on the Mapping icon.

The mapping file needs to be created ‘manually’ in the source view: the NewEmployee Event is known as an AnyType – therefore the visual mapper does not  do it for us.

The XSLT we need to create the XML document required by the File Adapter Service to write the New Personnel file looks like this, retrieving the required values from the NewEmployee event payload:

With the Mapping done, we can deploy the Composite to the SOA runtime.



Copying a new employee file to the c:\temp\hr directory, we start off a new instance of the ReadNewEmployee Composite. That instance publishes a NewEmployee event that the EDN will hand over to the ConsumeNewEmployeeEvent Mediator Component. 

This Instances overview for the ConsumeNewEmpEvent component shows the consumption of the event:


The Audit Trail for the instance :

It is clear that the instance was instantiated because of the Business Event. It then delivered the Event payload into the File Adapter Service that will write out the personnel file.

We can see the result of this instance on the file system, as the ConsumeNewEmpEvent Mediator Component has created a new personnel file in the personnel directory:

The contents of this file:


In two prequels to this article we have seen how we can define a Business Event Type in the context of the Oracle 11g SOA Suite and how we can publish events of that type in Mediator Components. In this article, we see how a Mediator Component can register itself as subscriber to a Business Event type. Such Component are then instantiated by the Event Delivery Network when the events for which they registered occur.

In this way, an event in one Component indirectly instantiates a completely different Component. That is loosely coupling for you – without even knowing about each other and only a dependency on the Event (type), these two Components seem to collaborate.

4 thoughts on “Oracle 11g SOA Suite – The Event Delivery Network – part 2- Subscribing to and Consuming Business Events

  1. Great job. I integrated it into the POProcessing samples, just replacing employees by PO.
    Andre, I don’t know if it works (didn’t try yet), but when you subscribe to an event, you can browse a different application to choose your edl.

  2. Excellent example. One question:
    Can this events only be consumed from within the same composite? Or can this events also be consumed in other applications within the same SOA environment?

Comments are closed.

Next Post

Automated SOAP testing with maven and the SoapUI plugin

Currently there are few tools that can support testing SOAP interfaces. Both Jmeter and SoapUI are suited for testing soap interfaces. SoapUI is explicitly created for testing SOAP interfaces and Jmeter has a SOAP support since version 2.3.x. I have worked with both tools and I prefer SoapUI. It has […]
%d bloggers like this: