19 Getting Started with Oracle Mediator This chapter provides you an overview of Oracle Mediator (Mediator) and also describes how to create an Oracle Mediator service component. 19.1 Introduction to Oracle Mediator Oracle Mediator provides a lightweight framework to mediate between various components within a composite application. Mediator converts data to facilitate communication between different interfaces exposed by different components, which are wired together to build a O! composite application. "or example, a Mediator can accept data contained in a text file from an application or service, transform it to a format appropriate for updating a database that serves as a customer repository, and then route and deliver the data to that database. Oracle Mediator facilitates integration between events and services, where service invocations and events can be mixed and matched. #ou can use a Mediator component to consume a business event or to receive a service invocation. ! Mediator component can evaluate routing rules, perform transformations, validate, and either invoke another service or raise another business event. #ou can use a Mediator component to handle returned responses, callbacks, faults, and timeouts. This section provides an overview of Oracle Mediator features$ •
%ontent&'ased and eader&'ased outing
•
ynchronous and !synchronous *nteractions
•
e+uential and arallel outing of Messages
•
Transformations
•
-alidations
•
ava %allout
•
/vent andling
•
0ynamic outing
•
/rror andling
•
Multiple art Message upport
Oracle Mediator provides support for setting rules based on message payload or message headers. #ou can select elements or attributes from the message payload or the message header and based on the values, you can specify an action. "or example, Mediator receives a file from an application or service containing data about new customers. 'ased on the country mentioned in the customer1s address, you can route and deliver data to the database storing data for that particular country. imilarly, you can route a message based on the message header. "or more information about access header&based routing, see ection 23.2.2.4, 5!ccess eaders for "ilters and !ssignments5 . •
ynchronous and !synchronous *nteractions Oracle Mediator provides support for synchronous and asynchronous re+uest response interaction. *n a synchronous interaction, the client re+uests for a service and then waits for a response to the re+uest. *n an asynchronous interaction, the client invokes the service but does not wait for the response. #ou can specify a timeout period for an asynchronous interaction, which can perform some action, such as raise an event or start a process. "or more information about synchronous and asynchronous interactions, see ection 23.2.2.6, 5andling esponse Messages5 and %hapter 26, 57nderstanding Message /xchange atterns of a Mediator5 .
•
e+uential and arallel outing of Messages ! routing rule execution type can be either parallel or se+uential. #ou can configure the execution type from outing ules panel. "or more information about se+uential and parallel routing of messages, see ection 23.2.2.2, 5pecifying e+uential or arallel /xecution5 .
•
Transformations Oracle Mediator supports data transformation from one 8M9 schema to another. This feature enables data interchange among applications using different schemas. "or example, you can transform a comma&delimited file to the database table structure. "or more information about transformations, see ection 23.2.2.:, 5%reating Transformations5.
•
-alidations Oracle Mediator provides support for validating the incoming message payload by using a chematron or an 80 file. #ou can specify chematron files for each inbound message part and Oracle Mediator can execute chematron file validations for those parts.
"or more information about validations, see ection 23.2.2.;3, 57sing emantic -alidation5 and http$<
ava %allout Oracle Mediator provides support for ava callout. ava callouts enable the use of ava code, together with regular expressions. "or more information about ava callout, see ection 23.2.2.;;, 5upport for ava %allouts5.
•
/vent andling !n event is message data sent because of an occurrence of an activity in a business environment. Oracle Mediator provides support for subscribing to business events or raising business events. #ou can subscribe to a business event that is raised when a situation of interest occurs. "or example, you can subscribe to an event that is raised when a new customer is created and then use this event to start a business process such as sending confirmation email. imilarly, you can raise business events when a situation of interest occurs. "or example, raise a customer created event after completing the customer creation process. "or more information about event handling, see %hapter 6=, 57sing 'usiness /vents and the /vent 0elivery >etwork5.
•
0ynamic outing 0ynamic outing separates the control logic, which determines the path taken by the process, from the execution of the process. #ou can create a dynamic routing rule from the Mediator /ditor. "or more information about dynamic routing, see ection 23.2.6, 5%reating 0ynamic outing ules5.
•
/rror andling Oracle Mediator supports both fault policy&based and manual error handling. ! fault policy consists of conditions and actions. %onditions specify the action to be carried out for a particular error condition. "or more information about error handling, see %hapter 22, 57sing Mediator /rror andling5.
•
Mediator /cho upport Oracle Mediator supports echoing source messages back to the initial caller after any transforms, validations, assignments, or se+uencing are performed. "or more information about Mediator echo support, see 5To echo a service$5.
•
Multiple art Message upport Oracle Mediator supports messages consisting of multiple parts. ome emote rocedure %all (%) web services contain multiple parts in the O! message. "or more information about multiple part message support, see %hapter 2;, 5?orking with Multiple art Messages in Mediator5 .
Difference between Mediator and BPEL #ou have many tools to use in a composite, and they may overlap for some cases. Mediator is particularly useful for content based routing of events, and as a listener for events. '/9 of course offers more possibilties for business logic and would generally be suited to defining process logic. ! more complex O! composite likely includes both components and others as well.
Mediator serves the purpose of a bus. *t can be best utili@ed when used for routing. *t can do routing based on many parameters and the best part is, the routing rules can be modified at runtime, thus giving the flexibility to choose the target at any point in time. '/9 ;) %omplex 9ogic 2) Aood upport language in form of BactivitiesB 6) erformance wise very slow C) upport of 0ehydration and *nstance Monitoring D) "or 9ong unning process '/9 is the ight olution =) To implement the contolled Transactions *ntegration of ules /ngine and uman ?orkflow :) To implement the service virtuali@ation '/9 is not the right approach Mediator ;) 9ess %omplex 9ogic 2) 9ess upport 6) Three times faster than '/9 C) >o support of de hydration D) "or 9ong unning process not a proper solution
=) #ou can not control the transactions in Mediator. :) Mediator is the right approach for the service virtuali@ation Virtualiation E ervice virtuali@ation provides companies with the ability to create virtual services that offer a stable interface (location, transport, standards, policies, messages) even when the physical service changes. Virtualiation offer! high"a#ailabilit$ and load" balancing% &erfor'ance and SL( 'onitoring and 'anage'ent% routing% #er!ioning% and 'ediation ca&abilitie! to 'itigate the i'&act of change at the &ro#ider on !er#ice con!u'er!. Mediator is used for Transformation and outing. outing&&&&&&&&&&&&&&&&&&tatic routing and 0ynamic outing tatic&&&&&&&&&&&&&&&&erviced 'ased F /vent 'ased 0ynamic&&&&&&&&&&&&'usiness ules
•
Oracle /nterprise ervice 'us (O/') o
o
o
o
•
old G/'H EO/' was the primary /' prior to '/! a+uisition. !fter ac+uisition of '/! its role is to provide mediation services between O! uite components *n ;;g this will be known as the Mediator and acts as a component in an %! assembly O/' is the only /' available if running on a non&?eblogic server
Oracle ervice 'us (O') o
reviously known as '/! !+ualogic ervice 'us (!9')
o
OracleIs primary service bus
o
o
the preferred platform for service virtuali@ation and interactions external to the O! uite %urrently O' is only available on ?eb9ogic server but the intention is provide it on other platforms as well in the future
o
O' is the foundation of service bus functionality moving forward
o
%an be used independently, without O! uite
Mediator vs. Oracle ervice 'us (O') •
Mediator o
o
o
•
The HtinyB, Hlight weightB service bus 9imited to simple Mediator functionality for the implementation of the -/TO pattern
- alidate
/ nrich
T ransform
oute
O perate
-alue Mapping and %ross&eference Table for supporting the canonical datamodel
o
0eveloplent through 0eveloper *0/
o
/vent 0elivery >etwork for ublish&ubscribe semantic
o
Message Transformation with 89T
o
%an be used and deployed as a %! component
Oracle ervice 'us (O') o
The large, powerful service bus
o
/xtended functionality important for enterprise&wide *ntegration, like
o
Message Throttling
ervice ooling
eliable Messaging
0evelopment through /clipse *0/ or ?eb %onsole
o
Message Transformation over 8Juery and 89T
o
O' specific deployment
o
>ot yet integrated with %!