This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Mediators
A mediator is a full-powered processing unit in the ESB. At run-time, a mediator has access to all the parts of the ESB along with the current message and can do virtually anything with the message.
When adding a mediator to a sequence , you can configure the mediator in design view or in source view, which allows you to edit the source XML (different mediators have their own XML configurations). Mediators in a sequence can be one of the following types:
- Node mediators - Contains child mediators.
- Leaf mediators - Does not hold any other child mediators.
The message content is accessed by some mediators in some mediation scenarios while it is not accessed in the other scenarios. Mediators can be classified as follows based on this aspect.
- Content-aware mediators: These mediators always access the message content when mediating messages (e.g., Enrich mediator).
- Content-unaware mediators: These mediators never access the message content when mediating messages (e.g., Send mediator).
- Conditionally content-aware mediators: These mediators could be either content-aware or content-unaware depending on their exact instance configuration. For an example a simple Log Mediator instance (i.e. configured as
<log/>
) is content-unaware. However a log mediator configured as<log level=”full”/>
would be content-aware since it is expected to log the message payload.
Mediators are considered to be one of the main mechanisms for extending an ESB. You can write a custom mediator and add it to the ESB. This custom mediator and any other built-in mediator will be exactly the same as the API and the privileges.
The standard mediators in WSO2 ESB are listed in the table below. Click a link for details on that mediator. There are also many samples that demonstrate how to use mediators.
The Mediator Catalog
Category | Name | Description |
---|---|---|
Core | Call | Invoke a service in non blocking synchronous manner |
Enqueue | Uses a priority executor to ensure high-priority messages are not dropped | |
| Sends a message | |
Moves the message from the In flow to the Out flow, skipping all remaining configuration in the In flow | ||
| Inserts a reference to a sequence | |
Respond | Stops processing on the message and sends it back to the client | |
Event | Sends event notifications to an event source, publishes messages to predefined topics | |
| Drops a message | |
Call Template | Constructs a sequence by passing values into a sequence template | |
| Enriches a message | |
| Sets or remove properties associated with the message | |
| Logs a message | |
Filter | Filters a message using XPath, if-else kind of logic | |
| Applies to messages that are in the Out path of the ESB | |
| Applies to messages that are in the In path of the ESB | |
| Filters messages using XPath, switch logic | |
| Routes messages based on XPath filtering | |
| Implements complex routing rules (Header based routing, content based routing and other rules) | |
Transform | Performs XSLT transformations on the XML payload | |
FastXSLT | Performs XSLT transformations on the message stream | |
| Modifies and rewrites URLs or URL fragments | |
| XQuery | Performs XQuery transformation |
| Sets or removes SOAP headers | |
| Fault (also called Makefault) | Create SOAP Faults |
PayloadFactory | Transforms or replaces message content in between the client and the backend server | |
Advanced | Evaluate messages based on whether the same message came to the ESB | |
| Clones a message | |
| Stores messages in a predefined message store | |
| Splits a message | |
| Combines a message | |
| Blocks web services calls | |
| Executes a set of mediators transactionally | |
| Limits the number of messages | |
| Writes data to database | |
| Retrieves information from database | |
| Executes rules | |
| Evaluates user actions against a XACML policy | |
| 2-legged OAuth support | |
Extension | Creates and executes a custom mediator | |
| Executes a custom command | |
| Executes a mediator written in Scripting language | |
| Creates a mediator managed by Spring | |
| Used to apply lightweight transformations on messages in an efficient manner | |
Agent | BAM | Captures data events and sends them to the BAM server |