Tuesday, September 1, 2020

Mediator & EDN IQA

 

Q) What is Mediator?

The Mediator is in charge of interconnecting, within an SOA composite application, components that expose different interfaces. In addition, the Mediator can perform duties such as filtering and making routing decisions.

The composite editor in JDeveloper gives you the flexibility to define the interface now, to choose an existing interface, or to define the interface later as you wire components to the Mediator.

Transforming data from one representation to another is, along with routing, one of the key functions of the Mediator.

 Provides mediation capabilities such as routing, transformation, and validation capabilities.

The mediator component enables data routing between the service consumer and provide based on routing rules.

Route  a data btn service provider and consumers within a composite applications.

It support both Synchronous and Asynchronous routing of data.

VETRO- Validate,Enrich,Transform,Route and Operate.

Provides services like

-> Content based routing and header based routing
-> Sequential and parallel routing
->  Message re-sequencing
->  Data transformation
->  Payload validation
->  Event Handling

Content based routing means that the routing is done on the whole message body rather than on single property like routing key.
u can think of message headers as of a simple table containing name-value pairs.
checks for the first order symbol.  Based on the content it forwards the message to the specific destination.
Use a Content-Based Router to route each message to the correct recipient based on message content. 

Q) What Is The Role Of Oracle Mediator?

Oracle Mediator provides a lightweight framework to mediate between various components within a composite application.

Oracle Mediator converts data to facilitate communication between different interfaces exposed by different components that are wired to build a SOA composite application.

Q) What Is The Purpose Of Oracle Mediator?

Oracle mediator is used for route, validate, filter and transform data from service providers to external partners.
"Route: Determines the service component (BPEL process, business rule, human task, and mediator) 
to which to send the messages."
"Validate: Provides support for validating the incoming message payload by using a schematron or an 
XSD file."
"Filter: If specified in the rules, applies a filter expression that specifies the contents (payload) of a
 message be analyzed before any service is invoked."
"Transformation: If specified in the rules, transforms document data from one XML schema to another,  thus enabling data interchange among applications using different schemas."

Q) Define a mediator with respect to the implementation process of SOA

Routing

Transformation

Filter: to give condition

The mediator is responsible for interconnecting a variety of composite applications.

It is also quite adept at exposing different interfaces with the varied number of components.

Moreover, the mediator can also perform various kinds of duties which comprise (include) of filtering so that the routing decisions can be implemented.

On the other hand, it is also important to note that the composite editor which is present in the JDeveloper would give you the usability to illustrate the interface.

Moreover, with the help of the mediator, you can change data from one representation to the other. It is also one of the critical functionalities of the mediator. 

Q) When to use Mediator?
 Mediator is one of the components of Oracle SOA Suite tool. This component is used in below two scenarios.
1. When we need to fetch the information from source and pass to target with or without transformation.
2. When we use multiple components in one composite then it recommended that these components should interact through mediator component.

Q) Mediator Features
Content -based and header -based routing
Synchronous/ Asynchronous interactions
Service Virtualization
Validations
Transformations
Routing
Enrichment
Event handling
error handling
Message enrichment

Q) Mediator Component Creation option

-          Define interface later

-          Asynchrounous Interface

-          Synchrounous Interface

-          One-way interface

-          Interface definition from wsdl

-          Subscribe to events 

Mediator component

Define Interface Later: This option enables you to create a Mediator first, and later define the interface for the services, or subscribe to events. 

Asynchronous Interface: This option enables you to create a Mediator component for asynchronous interaction.

Synchronous Interface: This option enables you to create a Mediator component for synchronous interaction.

One-Way Interface: This option enables you to create a Mediator component for a one-way interaction process. In this case, the client sends a message to the service, and the service does not need to reply or even acknowledge the receipt of the message. 

Interface Definition from WSDL: This option enables you to define services for the Mediator component from a WSDL file. A WSDL file describes the interface of a Mediator such as schemas and operations. 

Subscribe to Events: This option enables you to subscribe to a business event that is raised when a situation of interest occurs.

Q)Routing rule in mediator
Routing rules in mediator used to define routing e.g. when we need to transfer the message from one point to another then we define one routing rule in mediator.

It specify where the message is sent,  how it is sent  and what changes are made to the message before it is sent.
Routing data, which is the main purpose of a Mediator component, is accomplished by adding one or more routing rules. 
Each routing rule specifies a target service for the data, which may be communicated synchronously or asynchronously. 
Routing rules can handle returned responses, callbacks, faults, timeouts, and specify content-based and header-based filtering criteria, thereby enabling data to be routed to a suitable target.

To configure routing rule:
Target service
Filter expression
Execution type
Schematron-based validation
Transformations
Reply,callback and fault handlers

Define one or more routing rules that can:
Filter data
Transform data
Validate data

Q) How many types of routing rules are there?
There are two types of routing rules in mediator.
1. Dynamic routing rule
2. Static routing rule

Q) What is dynamic routing rule ?
 A Dynamic Routing Rule configures a Business Rules component that uses a decision table to determine the target endpoint to which a message is routed through a dynamic external service interface. It can only be created for asynchronous interactions.

A dynamic routing rule lets you externalize the routing logic to an Oracle Rules Dictionary, which in turn enables dynamic modification of the routing logic in a routing rule.

Q) What is static routing rule ?
 These rules are used when target reference is known to us. It can be created for an event subscription, an incoming operation for an synchronous and asynchronous service interaction.

Q) How many types of static routing rules we have?
 Static routing rules is of two types.
1. Sequential
2. Parallel

Q) What is the difference between sequential and parallel routing rule ?
 Below are the difference between sequential and parallel routing rules.
Sequential:
1. These routing rules evaluated and performed sequentially.
2. These routing rules executes in single thread.
3. Oracle Mediator never commits or rolls back transactions propagated by external entities.
4. Oracle Mediator always enlists itself into the global transaction propagated through the thread that is processing the incoming message.
Parallel
1. These routing rules evaluated and performed in parallel order.
2. These routing rules executes in parallel (multiples) threads.
3. Oracle Mediator commits or rolls back transactions because it is the initiator of these transactions.
4. Oracle Mediator initiates a new transaction for processing each parallel rule.

Q) Can we have both sequential and parallel routing rules in one mediator?
 yes, we can have both sequential and parallel routing rules in one mediator.

Q) Which rule execute first if we have both sequential and parallel routing rules in mediator?
 If we have both sequential and parallel routing rules, first sequential routing rules are evaluated and actions are performed, and then parallel routings are queued for parallel execution.

Q) What is resequencing in Mediator?

The re-sequencing feature of the Oracle Mediator reorders sets of messages that might arrive to the Oracle Mediator in the wrong sequence. You can define re-sequencing for all operations in an Oracle Mediator or for a specific operation. 

A Resequencer is used to rearrange a stream of related but out-of-sequence messages back into order. It sequences the incoming messages that arrive in a random order and then send them to the target services in an orderly manner.

It will sequence the output file in a sequence independent of the input order.

For the resequencer to work we need to have 2 values in the source payload. The first one is a sequenceID, and the next one is a groupdID. 

The sequenceID will be used as identifier for the message itself. 

The groupID will be used to group the messages in which the resequencer will rearrange the messages based on the sequenceID. 

Different groups will have seperate processing, so they won’t have any influence on each other.

The mediator supplies us 3 types of resequencers :

->  Standard Resequencer
->  FIFO Resequencer
->  BestEffort Resequencer

Q) Echo pattern of the Mediator

An Echo is a simple “reply to the caller” pattern where the requester immediately gets back a response.

Act as a callable service without routing to any other service.

EX:

In this example which is an echo pattern, the request comes from the WebService, goes to the mediator, undergoes some transformation in the mediator, and finally is routed back to the WebService.

we need to create a routing rule in the mediator with an Echo Pattern.

Double click on the mediator component in the composite.xml which will open a .mplan file which is the heart of the mediator component where all the operations of the mediator 

Click on the + icon of the Routing Rules –> Static Routing Rule –> Echo

Q) What Is Echo In Oracle Mediator?

The purpose of the echo option is to expose all the Oracle Mediator functionality as a callable service without having to route it to any other service. 

For example, you can call an Oracle Mediator to perform a transformation, a validation, or an assignment, and then echo the Oracle Mediator back to your application without routing it anywhere else.

For synchronous operations with a conditional filter,  the echo option does not return a response to the caller when the filter condition is set to false. Instead, it returns a null response.

The echo option is available for asynchronous operations only if the Oracle Mediator interface has a callback operation.

In this case, the echo is run on a separate thread.

You can also echo source messages back to the initial caller after any transformation, validations, assignments, or sequencing operations are performed. 

An echo can only be specified if the Oracle Mediator component has a synchronous or asynchronous interface. 

Whether the echo is synchronous or asynchronous depends on the WSDL file of the caller. 

The echo option is only available for inbound service operations and is not available for event subscriptions.

 Ex:

Note: But if you want to implement the re-sequencing of incoming message before calling to external system/process, which can’t be achieve with BPEL. In this case we only Mediator can solve the problem.  


Use-case: In banking systems or customer care center, when ever a customer approaches the system, a token id or request id will be issued based on the category/type of issues. For e.g. banks will issue a token id based on saving account or current account or demat account issue etc. when it comes to processing of the request, banks will process the customers in a sequence order. So the customer is supposed to submit the token id issued to them. If any customer bypasses other customers, the system will process those request until their turn comes up.

Validations
Oracle mediator supports validation of incoming message payload for structure and semantics.
Use an xsd file for structural validation
Use an schematron file for semantic validation.

Transformation
-> Oracle mediator supports data transformation from one xml schema to another.
-> Transformations, defined in xsl files transforms document data from one xml file to another.
-> Xsl files can be visually designed by using the xslt mapper provided by oracle jdeveloper.
-> The xsl file deployed with the composite application so that the mediator engine can process the mapping rule in an xsl processor available in the oracle SOA suit run-time environment.

Q) can we use DVM in Mediator?
 yes, we can use DVM’s in mediator.

Q) can we validate the incoming XML message?
Yes, we can validate the incoming XML message in mediator by selecting “Validate Syntax(xsd)” checkbox.

Q) What is Schematron Validation?
 Schematron is an XML schema language, and it can be used to validate XML contents in an XML payload.

Which static routing rule support fault policy ?
 Parallel rules only.

Q) How many faults can Oracle Mediator service engine throw ?
 Only One

Q) Event Delivery Network(EDN)

-          Is issued for asynchronous messaging, triggered by a business or system event.
-          Enable SOA with Event-Driven Architecture(EDA)
-          Supports publish/subscribe architecture pattern

Note: Publishing an event means sending an alert on some specific action and subscribing 
to event is like doing needful action for the alert.

Q)Event Handling:
Event: An occurrence of business / system event that must be notified to other application.
Business event: Defines the structure of the event, message when it occurs.

Note
-> Oracle mediator component supports  publishing/subscribing to business events in the EDN avaible in oracle SOA Suit.
-> Using mediator, data validate/filter rules can be set based on the message payload or message headers.
-> Oracle mediator supports both synchronous and asynchronous request-response  messaging patterns.
-> Oracle mediator supports virtualization within the composite allowing to separate a service from its physical implementation.

Q) The service infrastructure of Oracle SOA Suite.
With the preceding capabilities, a variety of integration patterns can be implemented, such as:

Service aggregation: 
Services are combined and then exposed as a single interface that consumers can connect to via web services.

Publish and subscribe:
 One input channel splits into multiple output channels, one for each subscriber. 


No comments:

Post a Comment

SOA Overview Part-1

  Middleware It provides a mechanism for the process to interact with other processes running on multiple network machines. Advantages...