Friday, May 21, 2010

Event delivery Network – publishing events using SQL API

Business Events always had been an interesting option when it comes to initial design of an interface. For all real time integrations, we will always prefer a business event in case end system supports it. In scenarios where business events are not supported, applications are developed to sense pre-defined conditions or continuously poll for new events. But these do not offer the flexibility and scalability required to handle new and more complex changes that will come in the future. In other scenarios, the business event feature may be there but the business event may not contain the entire payload which needs to be fetched using the ids provided as part of the business event data. Business Events is one of the new features in SOA Suite 11g, named as the Event Delivery Network (EDN). Event-driven architecture can always complement service-oriented architecture (SOA) because services can be activated by triggers fired on incoming events.

Refer the blog by Clemens on how to publish/subscribe to an event using Java APIs

I will throw some light on the steps involved as well as the internal APIs provided by EDN that you can use to publish events.

Publisher and Subscriber needs to be aware of the data format that they need to communicate in. So the first step will be to define the Payload of the business event. For this define an XSD schema which will become your payload.

On subscriber side we need to define Business Event through an edl file.

<definitions xmlns="" targetNamespace="' ">

<schema-import namespace="" location="xsd/Employee.xsd"/>

<event-definition name="createEmployee">

<content xmlns:ns0="" element="ns0:Employee"/>


<event-definition name="removeEmployee">

<content xmlns:ns0="" element="ns0:Employee"/>



Important thing to note is an event will be in its own namespace for example -“'” and the payload will have its own namespace - “”

There are a couple of tables and queues defined in SOAINFRA schema with the prefix EDN which are used as part of the event delivery system in SOA suite 11g. There is a queue named ‘edn_event_queue’ which is used to store all the published events. It uses underlying EDN_EVENT_QUEUE_TABLE for storing all the event payloads.

There is an internal API which is being called by the java SendEvent class to publish the data on to the queue. The API is ‘edn_internal_publish_event’. So in cases where we need to publish an event from functions and procedures we can call this publish API on the SOAINFRA schema.

code snippet on how to publish an event using SQL API

call edn_internal_publish_event('','createEmployee','<business-event xmlns:ns1="'" xmlns="">




<Employee xmlns="">

< EmpID>101</EmpID>

< Name>Geo Tho</ Name >

< Department>Engineering</Department >

</ Employee>



', 'R', null, null, '3')

First parameter will be the namespace of the event, second will be business event-definition name from edl file, third being the payload (business event tags are required), and sixth parameter being the priority. Hope this helps.


Anonymous said...

Great article!


For components to publish or subscribe to events, the events (edl file) needs to be published to the MDS Is that right? if true, how can I do it?

George Thomas said...

It is not required to publish the edl files to MDS.MDS is just for centralizing the artifacts.

Anonymous said...

Hi! I tried the example but keep having an error message on the log
oracle.fabric.common.FabricException: Connection closed.

Any ideas?