WSO2 ESB Mediator

Mediators provide an easy way of extending the ESB functionalities. WSO2 ESB is based on the WSO2 Carbon platform, which uses OSGI as the underlying technology. It implies everything that runs inside the WSO2 ESB to be OSGI bundles.



There are two ways of writing the ESB mediator:
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).

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
    CoreCallInvoke a service in non blocking synchronous manner
    EnqueueUses a priority executor to ensure high-priority messages are not dropped
    SendSends a message
    LoopbackMoves the message from the In flow to the Out flow, skipping all remaining configuration in the In flow
    SequenceInserts a reference to a sequence
    RespondStops processing on the message and sends it back to the client
    EventSends event notifications to an event source, publishes messages to predefined topics
    DropDrops a message
    Call TemplateConstructs a sequence by passing values into a sequence template
    EnrichEnriches a message
    PropertySets or remove properties associated with the message
    LogLogs a message
    FilterFilterFilters a message using XPath, if-else kind of logic
    OutApplies to messages that are in the Out path of the ESB
    InApplies to messages that are in the In path of the ESB
    ValidateValidates XML messages against a specified schema.
    SwitchFilters messages using XPath, switch logic
    RouterRoutes messages based on XPath filtering
    Conditional RouterImplements complex routing rules (Header based routing, content based routing and other rules)
    TransformXSLTPerforms XSLT transformations on the XML payload
    FastXSLTPerforms XSLT transformations on the message stream
    URLRewriteModifies and rewrites URLs or URL fragments
    XQueryPerforms XQuery transformation
    HeaderSets or removes SOAP headers
    Fault (also called Makefault)Create SOAP Faults
    PayloadFactoryTransforms or replaces message content in between the client and the backend server
    AdvancedCacheEvaluates messages based on whether the same message came to the ESB
    ForEachSplits a message into a number of different messages by finding matching elements in an XPath expression of the original message.
    CloneClones a message
    StoreStores messages in a predefined message store
    IterateSplits a message
    AggregateCombines a message
    CalloutBlocks web services calls
    TransactionExecutes a set of mediators transactionally
    ThrottleLimits the number of messages
    DBReportWrites data to database
    DBLookupRetrieves information from database
    EJBCalls an external Enterprise JavaBean(EJB) and stores the result in the message payload or in a message context property.
    RuleExecutes rules
    EntitlementEvaluates user actions against a XACML policy
    OAuth2-legged OAuth support
    SmooksUsed to apply lightweight transformations on messages in an efficient manner.
    ExtensionBeanManipulates JavaBeans
    ClassCreates and executes a custom mediator
    POJOCommandExecutes a custom command
    ScriptExecutes a mediator written in Scripting language
    SpringCreates a mediator managed by Spring
    AgentBAMCaptures data events and sends them to the BAM server


    References

    No comments:

    Post a Comment