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/.

Event Mediator

The Event Mediator redirects incoming events to the specified event topic. For more information, see Working with Topics and Events.

The Event mediator is a content-aware mediator.



Syntax

<event xmlns="http://ws.apache.org/ns/synapse" topic="" [expression=""] />

UI Configuration

The parameters available for configuring the Event mediator are as follows:

Parameter NameDescription
Topic Type

The type of topic. The available options are as follows.

  • Static: If this is selected, the topic to which the events are published is a static value.
  • Dynamic: If this is selected, the topic to which the events are published is a dynamic value that should be derived via an XPath expression.
Topic

The topic to which the events should be published. You can enter a static value or an XPath expression based on the option you selected for the Topic Type parameter.

Tip

You can click NameSpaces to add namespaces when you are providing an expression. Then the Namespace Editor panel would appear where you can provide any number of namespace prefixes and URLs used in the XPath expression. 

Expression

The XPath expression used to build the message to be published to the specified topic.

Tip

You can click NameSpaces to add namespaces when you are providing an expression. Then the Namespace Editor panel would appear where you can provide any number of namespace prefixes and URLs used in the XPath expression. 

Note

You can configure the mediator using XML. Click switch to source view in the Mediator window.


Examples

In this example, when an event notification comes to the EventingProxy proxy service, they are processed by the PublicEventSource sequence, which logs the messages and publishes them to the topic SampleEventSource. Services that subscribe to the topic SampleEventSource will then receive these messages.

<!-- Simple Eventing configuration -->
 <definitions xmlns="http://ws.apache.org/ns/synapse">

     <sequence name="PublicEventSource" >
            <log level="full"/>
            <event topic="SampleEventSource"/>
     </sequence>

     <proxy name="EventingProxy">
         <target inSequence="PublicEventSource" />
     </proxy>
 </definitions>

Sample

See the following sample for another example.

 Sample 460: Introduction to Eventing and Event Mediator.