26. • The simplest functional component available in WSO2
ESB
• A black box which accepts a message and carries out a
predefined task on it
• WSO2 ESB comes with a rich library of built-in mediators
–Log mediator : Logs the message
–Send mediator: Sends the message to a URL
–XSLT mediator : Performs an XSLT transformation on the message
Configuration
Data
Input Message Output Message
27. …
• Transforming messages
–eg: XSLT mediator, Payload factory mediator
• Manipulating message headers and properties
–eg: Header mediator, Property mediator
• Replicating, splitting and aggregating messages
–eg: Clone mediator, Aggregate mediator
• Filtering messages
–eg: Filter mediator, Switch mediator
• Custom Mediation
–Eg: Class mediator, Script mediator
• And lot more…
–http://docs.wso2.org/display/ESB481/Mediators - complete list
28. • A sequential arrangement of mediators – A mediator
chain!
• When a message is handed to a sequence it is given to
the first mediator of the chain - The outcome of that will
be handed to the second mediator of the chain and so
on…
• The messages are sent through the chain while
mediators perform various actions on it along the way
• Pipelining in action!
29. …
● Consider the example sequence shown above
− Messages are first logged by the log mediator
− The property mediator sets a property on the messages
− Then they are sent to a specified endpoint by the send
mediator
− It is a simple log-and-forward message flow!
30. ● Defines an endpoint reference (EPR) to which
messages can be sent/forwarded from the ESB
− The send mediator takes an endpoint as an argument
● Various operational constraints can be enforced on
an endpoint
− Timeout duration
− Message format (REST, POX, SOAP 1.1, SOAP 1.2)
● QoS expectations can be set on an endpoint
− Security
31. ● Main types of endpoints
− Address endpoint (A simple URL)
− WSDL endpoint (Extracts the EPR from a WSDL)
− HTTP endpoint ( To invoke REST services with URL
parameters)
− Default endpoint ( Adding QoS and other constraints)
− Load balance endpoints (Divides the requests among
several child endpoints)
− Fail over endpoints (Detects errors that can occur while
sending the messages and resends them to a backup
endpoint)
32. ● Acts like a virtual service that can receive requests
from clients
● Received client requests are processed and routed
to a specified endpoint (usually to an actual service –
backend service)
● Responses coming back from the backend service
are further processed and forwarded to the clients
● Resembles traditional HTTP proxy servers
35. o If you have a REST front-end client, REST back-end
service, or both a REST client and service, you can use a
proxy service in the ESB to handle the communication
between the front end and back end
o REST Client and SOAP Service
o SOAP Client and REST Service
o REST Client and REST Service
o JMS Client and REST Service
o https://docs.wso2.org/display/ESB481/Using+REST+with+a+Proxy+Service
*
36. o API anchored at URL context
o e.g., GET /test
o Resources
o Component of API accessed through HTTP call
o Similar to proxy service (in, out, and fault sequences) but more
limited
o Can restrict resource’s scope using URL patterns and URI
templates
*
38. o URL mapping
oPath mappings (eg: /test/*, /foo/bar/*)
oExtension mappings (eg: *.jsp, *.do)
oExact mappings (eg: /test, /test/foo)
o URI template
o/order/{orderId} would process /order/A0001
o/dictionary/{char}/{word} would process
/dictionary/c/cat
o Use get-property to retrieve exact values
<log level="custom">
<property name="Character" expression="get-
property('uri.var.char')"/>
<property name="Word" expression="get-property
('uri.var.word')"/>
</log>
*