Event mediator publishes events to the given event source. Thus, the presence of defined event sources are necessary prior to the usage of this mediator. User can apply any mediation before sending the message to the event source. This allows features like transformation, logging, filtering to be applied to a message coming to an Event Source.
<syn:eventPublisher eventSourceName="event-source-name"/>
<!-- Simple Eventing configuration --> <definitions xmlns="http://ws.apache.org/ns/synapse"> <eventSource name="SampleEventSource"> <subscriptionManager class="org.apache.synapse.eventing.managers.DefaultInMemorySubscriptionManager"> <property name="topicHeaderName" value="Topic"/> <property name="topicHeaderNS" value="http://apache.org/aip"/> </subscriptionManager> </eventSource> <sequence name="PublicEventSource" > <log level="full"/> <eventPublisher eventSourceName="SampleEventSource"/> </sequence> <proxy name="EventingProxy"> <target inSequence="PublicEventSource" /> </proxy> </definitions>
In this scenarion user has defined an event source called SampleEventSource. When a event notification comes to the EventingProxy proxy service, the messages will be logged and then sent to the event source.