Wednesday, December 21, 2011

WPS: Mediation flow and it's Primitives

Mediation services can inspect, modify, augment and transform a message as it flows from requestor to provider.

The heart of a mediation module is the mediation flow component, which provides the mediation logic applied to a message as it flows from a service consumer to a provider. The mediation flow component is a type of SCA component that is typically used, but not limited to a mediation module. A mediation flow component contains a source interface and target references similar to other SCA components. The source interface is described using WSDL interface and must match the WSDL definition of the export to which it is wired. The target references are described using WSDL and must match the WSDL definitions of the imports or Java components to which they are wired. The mediation flow component handles most of the ESB functions including:
  • Message filtering which is the capability to filter messages based on the content of the incoming message.
  • Dynamic routing and selection of service provider, which is the capability to route incoming messages to the appropriate target at runtime based on predefined policies and rules.
  • Message transformation, which is the capability to transform messages between source and target interfaces. This transformation can be defined using XSL stylesheets or business object maps.
  • Message manipulation/enrichment, which is the capability to manipulate or enrich incoming message fields before they are sent to the target. This capability also allows you to do database lookups as needed.
  • If the previous functionalities do not fit your requirements, you have the capability of defining a custom mediation behavior in JAVA.

Mediation primitives

What are the various mediation primitives available in WESB?
Mediation primitives are the core building blocks used to process the request and response messages in a mediation flow.
  • Built-in primitives, which perform some predefined function that is configurable through the use of properties.
  • Custom mediation primitives, which allow you to implement the function in Java.
  • Mediation primitives have input and output terminals, through which the message flows. Almost all primitives have only one input terminal, but multiple input terminals are possible for custom mediation primitives.
  • Primitives can have zero, one, or more output terminals.
  • There is also a special terminal called the fail terminal through which the message is propagated when the processing of a primitive results in an exception.
The different types of mediation primitives that are available in a mediation flow :


Service invocation:

Service Invoke: Invoke external service, message modified with result

Routing primitives:

Message Filter: Selectively forward messages based on element values
Type Filter : Selectively forward messages based on element types

Endpoint Lookup : Find potential endpoint from a registry query
Fan Out : Starts iterative or split flow for aggregation
Fan In : Check completion of a split or aggregated flow
Policy Resolution: Set policy constrains from a registry query
Flow Order : Executes or fires the output terminal in a defined order
SLA Check : Verifies if the message complies with the SLA
Gateway Endpoint Lookup: Finds potential endpoint in special cases from a registry
UDDI Endpoint Lookup: Finds potential endpoints from a UDDI registry query

Transformation primitives:

XSL Transformation : Update and modify messages using XSLT
Business Object Map : Update and modify messages using business object maps
Message element setter : Set, update, copy, and delete message elements
Set message type : Set elements to a more specific type
Database Lookup : Set elements from contents within a database
Data Handler : Update and modify messages using a data handler
Custom Mediation : Read, update, and modify messages using Java code
SOAP header setter : Read, update, copy, and delete SOAP header elements
HTTP header setter : Read, update, copy, and delete HTTP header elements
JMS header setter : Read, update, copy, and delete JMS header elements
MQ header setter : Read, update, copy, and delete MQ header elements

Tracing primitives:

Message logger : Write a log message to a database or a custom destination
Event emitter : Raise a common base event to CEI
Trace : Send a trace message to a file or system out for debugging

Error handling primitives:

Stop : Stop a single path in flow without an exception
Fail : Stop the entire flow and raise an exception
Message Validator : Validate a message against a schema and assertions

Mediation subflow primitive:

Subflow : Represents a user-defined subflow