Oracle Event Delivery Network, produce events from within plsql

With the release of the soa suite 11g Oracle supplies us the EDN component, Event Delivery Network.
Basically it supplies us a publish/subscribe model to trigger and subscribe on defined business events.

For this little demo a created the next event definition
[sourcecode language=”xml”]







[/sourcecode]

To ‘throw’ the events we can make use of both the java and plsql apis.
For this demo i will shorty show how to trigger them from bpel/the console and a plsql call.

The composite i created

The bpel interface will be used just for triggered the event.

In the bpel itself we will use the invoke activity to not invoke a partnerlink but to invoke/trigger the event.

The Mediator component will subscribe to the event and will just write it back to filesystem.

Or we can just use the Enterprise Manager console to trigger the events.
In the console go to the soa-infra application, rightmouseclick and go to ‘Business Events’.

Select the ‘Test Event’, click ‘Test’ and use for example the next payload

[sourcecode language=”xml”]

action from console
description from console

[/sourcecode]

Trigger from plsql

To be able to trigger the events from within plsql we just have to call a ready to use procedure from the soa_infra schema (DEV_SOAINFRA in my case).
Procedure to be called :
[sourcecode language=”xml”]
procedure edn_publish_event (
namespace in varchar2,
local_name in varchar2,
payload in clob,
priority in binary_integer default 5)
[/sourcecode]

The procedure is a wrapper for the next call
[sourcecode language=”xml”]
edn_internal_publish_event (namespace, local_name, payloadCopy, ‘S’, NULL, subject_info, priority);
[/sourcecode]

Which eventually will call
[sourcecode language=”xml”]
edn_enqueue_business_event (edn_business_event(namespace, local_name,
sys.xmltype.createXML(payload), NULL, NULL), source, subject_info, target, priority);
[/sourcecode]

Create a stored procedure :
[sourcecode language=”xml”]
create or replace
procedure call_edn_test
as
begin
edn_publish_event(
‘http://schemas.oracle.com/events/edl/TestEvent’,
‘EventElement’,

ns1:EventElement
d4cbd406-9c56-4f50-a8e5-2b59a0f02c87


action from plsql
description from plsql


‘, ‘1’);
end;
[/sourcecode]

After triggering the event from the console, bpel and plsql we will have 3 files in the output directory
[sourcecode language=”xml”]

action from plsql
description from plsql


action from console
description from console


action from bpel
description from bpel

[/sourcecode]

Conclusion

To implement decoupling in the middleware, events are an important concept to be use. Event Driven Architectures are based on them and in the Oracle SOA Suite Oracles supplies us the EDN (Event Driven Network) to help us implement such an architecture. To eventually be able to produce events from within the database and consume the events from the Middleware we could have used Oracle AQ and one of the JCA Adapters Oracle supplies us. To process events from the database and consume those in the Middleware by use of the EDN functionality we can now just make use of a simple database procedure call. The EDN will just process the event like every other event produced in the Middleware.

Download : EventToFile.zip (Jdeveloper project)

Share this Post:
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

4 Responses to “Oracle Event Delivery Network, produce events from within plsql”

[…] SOA Suite we can create events by use of the Event Driven Network (EDN). See my one of my last articles on how to produce such an event from with plsql or how to produce it from bpel. The next step in […]

commenter

This strategy requires a call to a stored procedure on the soa_infra schema. Not really feasible in the typical use case when capturing changes to tables in legacy databases. DBlink required!

commenter

Thanks a lot for the article.. its truly helpful for beginners..

I am also a beginner, and i understand the concept but still i did not get how to trigger the event by plsql call from console.. if you could provide steps for the same will be very helpful.

thanks for the article again.

Kranthi

commenter

Which console do you mean?
Eventually if you use a publish event in your composite (so this is a trigger moment) it will get handled by the plsql in the database.
What trigger moment do you mean by “console” ?

Leave a Reply:

Name (required):
Mail (will not be published) (required):
Website:
Comment (required):
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>