Getting Started With Oracle SOA Suite 11g R1 – A Hands-On Tutorial — Save 50%
Fast track your SOA adoption – Build a service-oriented composite application in just hours with this Oracle SOA book and eBook!
In a service-oriented world, a level of abstraction is needed for creation and use of events using business semantics, without the publisher or subscriber of the event ever having to worry about the mechanics of messaging. Oracle SOA Suite 11g addresses this with the introduction of a new feature in the form of the Event Delivery Network.
In this article by Heidi Buelow, Manas Deb, Jayaram Kasi, Demed L'Her and Prasen Palvankar, we will work with events using the unified services and events platform of Oracle SOA Suite 11g to provide an event-handling solution.
Creating truly decoupled composite SOA applications requires a complete separation of the service consumer and the service provider.This is typically achieved through the use of asynchronous messaging.In an asynchronous messaging pattern, applications can perform in a"fire and forget" mode. This removes the need of an application to know details of the application on the other side. Additionally, it also improves resource utilization as applications are not holding onto resources until the interaction is complete. On the other hand, this introduces complexities of creating and managing message queues and topics. It requires that both the publisher of the message and the consumer use the same messaging technology. Each messaging system also has its own constraints on the types of programming languages and environments that can use the service.
In a service-oriented world, this tight coupling to the implementation of the underlying messaging system is at odds with the fundamental requirement of implementation independence. What's needed is a level of abstraction that allows applications to generate an event using business terms and associate a business object in an implementation‑independent form.
Oracle SOA Suite 11g addresses this with the introduction of anew feature in the form of the Event Delivery Network.
The Event Delivery Network (EDN) in Oracle SOA Suite 11g provides a declarative way to use a publish/subscribe model to generate and consume business events without worrying about the underlying message infrastructure.
Developers only need to produce or consume events without having to deal with any particular messaging API like JMS, AQ, and MQ, and so on. Consuming an event means expressing an interest in the occurrence of a specific situation,while producing an event means advertising this occurrence.
Using the same concepts that are used in Web Service Definition Language (WSDL), EDN uses an XML-based Event Definition Language, which allows you to define the event and its associated,strongly typed data. This definition is then registered with the SOA Infrastructure and is available to all composites to publish or subscribe.
WSDL:Standard service interface model
JMS API:Application Programming Interface
EDL:Event Definition Language
Handful of raw types
Wealth of tools
Mostly coding tools
eBook Price: $35.99
Book Price: $59.99
This allows for a fully-declarative, business-oriented, rather than developer-oriented approach for using events in a SOA application.
Another feature of EDN is the ability to publish and subscribe to these events from a variety of programming environments such as Java, PL/SQL, SOA Composites, and ADF-BC applications.
With EDN, Oracle has fostered the concept of events in the context of SCA, and this has given birth to an additional SCA specification:the "Assembly Model Specification Extensions for Event Processing and Pub/Sub". Since EDN in Oracle SOA Suite 11g predates the specification, you will find differences in the details, but the concepts are the same and EDN will eventually be aligned with the standard that emerges from the specification.
Creating and managing event definitions
Events are defined using an Event Definition Language (EDL),an XML schema used to build business event definitions. An EDL consists of the following:
- A global name.
- Custom headers: These can be used for content-based routing without having to parse the XML payload and apply XPath queries to get at the value to be used for the routing decisions. For instance, one can put the purchase order type in the custom header. This easily accessible custom header could then be used to efficiently decide how to process delivered events.
- Payload definition: Typically this is an XML schema for the business data that needs to accompany the event. For example, a "NewPO"event's payload definition will be a schema for a purchase order.
Event definitions can be created declaratively in JDeveloper in a couple of different ways depending on triggering conditions.
To publish events from a SOA composite, one would create new event definitions and register them with the SOA Infrastructure. It is this option that you will be able to try out later in this article during the hands-on exercise.
If you want to raise events on one or more database operations such as insertion of a new row or update of an existing one, you can use ADF-BC to define these events. ApplicationDevelopment Framework(ADF), a model-view-controller pattern based UI development framework for creating Rich Internet Applications (RIAs) and BusinessComponents(BC), an object-relational mapping tool, provide an easy way to define events. ADF-BC has built-in support for associating these events with database actions like insert, delete, and modify. For example, an event called "NewCustomerAdded" could be generated every time a new customer record is inserted into the database.
Registered events, their subscribers, and any faulted deliveries can all be tracked and monitored using the Oracle Enterprise Manager, in the same fashion that you would be managing and monitoring other aspects of your SOA infrastructure.
Consuming events from the Event Delivery Network
The first step to consume an event is to discover its definition. Event definitions can be stored locally in a composite or globally on the server—in either case, they can be discovered through the JDeveloper resource catalogue.
To subscribe to an event within an SOA composite application,you start by defining a Mediator component, selecting the event of interest from a list of registered events in the network.
To further refine a subscription, and narrow down the information you will receive, you can define an XPath-based filter on your subscriptions. For example, for an event named "NewPOCreated", you could either subscribe to all "NewPOCreated" events (default when no filter is defined) or only those where the order amount is more than a million dollars (by defining an XPath-based filter on the order amount field within the payload).
eBook Price: $35.99
Book Price: $59.99
Tutorial: Use of Event Delivery Network (EDN) and POProcessing
Let's try out a simple EDN use case. We will extend a POProcessing example.
In order to follow the tutorial in this article you must have installed the product and learned how to use the WebLogic console to configure the JMS adapter and define queues and connection factories.
To illustrate the usage of events, you modify the existing POProcessing composite to accept new orders from two sources: the Web Service interface, which you have already implemented, and another application that will publish events to indicate new orders.
Modifying the composite to consume events
In this step, you modify the POProcessing composite to use EDN. You add a new mediator component called receivePO, which subscribes to an event called NewPO and sends the received PO to the routePO service.
Defining the event
- Open the POProcessing application in JDeveloper and open composite.xml,and click on the Event Definition Creation icon:
- In the Event Definition Creationwindow, enter POEvents as the name of the event definition. Accept the namespace value generated.
Event names are fully qualified names, which means the combination of a namespace and the event name together identify a unique event. For instance, the event called NewCustomerAdded with name space http://schemas.oracle.com/events/edl/POEvents is different than the event with the same name but under a different namespace, for example, event NewCustomerAdded with namespace http://schemas.oracle.com/event/edl/CRMEvents.
- Add a new event by clicking on the +icon.
- Select the PuchaseOrder element from the po.xsd file using the chooser.
- Enter NewPO as the name of the event and click on OK to close the Add an Eventwindow.
- Click on OK to complete the event definition.
- Close the POEvents.edl panel.
- Save all.
You have just created a new event called POEvent. It is now available to this and other composites to subscribe to or publish. Whenever this event is delivered,it will also carry with it a document for the new purchase order.
Subscribing to the NewPO event
- Drag-and-drop a Mediator component on to the composite.
- Name the mediator receiveNewPO.
- Select Subscribe to Events for the Template.
- Click on the + to add an event. Select the NewPO event from the Event Chooser window.
- Click on OK to accept and create the mediator.
- Save all.
- Connect the receiveNewPO mediator to the routePO mediator:
- Double-click on the receiveNewPO mediator and define a new transformation map. In the transformation-map, map the all the fields from the source to the target.
- Close the mediator and save all.
Deploying and testing
- Deploy the POProcessing composite tothe server.
- Browse to the EM console at http://localhost:7001/em.
- Right-click on folder soa-infra (soa_server1)under folder SOA:
- Click on item Business Events.
- You should see the Business Events management page with the NewPO event listed in the Events
- Select the event and click on the Test…button to publish the event.
- In the pop-up window, enter the following XML and click on Publish:
<productName>Sony Bluray DVD Player</productName>
- You should get a "The Event published successfully" message.
- Click on soa-infra in the navigation panel on the left to get the soa-infra dashboard.
- Click on the POProcessing composite to view new instances. You should see an instance created for processing the event you just published. Click on the instance ID to view the flowtrace.
This was just one way of publishing an event and will typically be used as away to test the composite. In most cases, the events will be published from a number of sources—from a Mediator, from PL/SQL by calling the EDN_PUBLISH_EVENT stored function or from a Java class using the EDNAPI. An ADF-BC application can also publish events based on database insert, update, and delete operations.
You cannot really build comprehensive SOA applications without business events. Traditionally, this requirement has been fulfilled by message-oriented-middleware(MOM). However, MOM-based solutions don't necessarily fit very well within a service-oriented architecture. They are low-level technical solutions that provide no business semantics, whereas one of the main objectives of creating services is to provide business functions using semantics that are better understood by business analysts.
With EDN, Oracle SOA Suite 11g fills this gap by providing an event-handling solution that allows creation and use of events using business semantics, without the publisher or subscriber of the event ever having to worry about the mechanics of messaging.
As you have seen in this short lab, events are created in away that directly maps to actual business events, in this case creation of a new purchase order. The process of subscribing to this event was done declaratively without having to configure any messaging queues or topics.
About the Author :
Demed L'Her is Director of Product Management at Oracle, where he is responsible for the Oracle SOA Suite. He has been with Oracle since 2006, focusing on ESB, JMS and next-generation SOA platforms. Before joining Oracle, Demed spent eight years with TIBCO Software, a pioneer in electronic trading, message-oriented middleware and enterprise integration. He has been involved in some of the largest messaging and integration projects around the world, from setting up trading floors in Tokyo to troubleshooting semiconductor manufacturing fabs in Arizona. Demed holds an Engineering Degree from the Ecole Nationale Suprieure des Tlcommunications de Bretagne, a Bachelor of Science in Electrical Engineering from Universit de Bretagne Occidentale and a Master of Science in Computer Science from Universit de Rennes I.
Heidi Buelow is a BPM Product Manager with Oracle and is responsible for Oracle BPM Suite and programs such as beta and technical previews. Heidi joined Oracle in 2006, and previously was Chief Application Architect developing a Business Process Management engine, developer toolset, and application framework. Heidi started her career as a software developer at Xerox working on the Xerox Network Services and Star Workstation products where she first learned to appreciate object-oriented and services-oriented technologies. She holds a Bachelor of Science degree in Computer Science from the University of Southern California.
Jayaram Kasi is a product manager with Oracle, and focuses on SOA technologies. Before that he had been a software architect for 20 years working on relational database kernels at HP, OLTP monitors based on DCE at HP, High Availability at HP, ECommerce Infrastructure at Commerce One, and Enterprise Service Bus at BEA. Jayaram has a Bachelor of Science degree in electrical engineering from the Indian Institute of Technology, and a Master of Science in electrical engineering from the University of Hawaii.
Manas Deb is a senior director in the Fusion Middleware/SOA, BPM, Governance Suites Product Group at Oracle HQ. He currently leads outbound product management and many strategic engagements initiatives for Oracle's SOA, BPM, and Governance solutions, worldwide. He is also responsible for Oracle/HQ-based SOA Methodology initiatives. He has worked in the software industry for over twenty years, most of which was spent in software product management/marketing and on architecting and leading a wide variety of enterprise-level application development and business integrations projects in a wide variety of industries. A graduate of The Indian Institute of Technology (KGP), Manas attended post-graduate studies at University of Texas at Austin. He received his PhD in an inter-disciplinary program comprising Computer Science, Applied Mathematics, and Engineering. Manas also has an MBA with specialization in international business.
Prasen Palvankar is a Director of Product Management at Oracle and is responsible for outbound SOA Suite and BPM Suite product-related activities such as providing strategic and architectural support to Oracle's SOA Suite and BPM Suite current and prospective customers and also includes field and partner enablement, and training. Prasen joined Oracle in 1998 and worked as a Technical Director in the Advanced Technology Solutions group in Oracle Consulting delivering large-scale integration projects before taking on his current role five years ago. Prior to joining Oracle, he worked as a Principal Software Engineer at Digital Equipment Corporation.
Books From Packt