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/.
Transform Events before Publish
Objective: Demonstrate the mediation capability of events before publishing to event sink.
Prerequisites:
- Deploy the
SimpleStockQuoteService
in sample Axis2 server and start it on port 9000. - Start Synapse with the sample configuration 502 (i.e.
wso2esb-samples -sn 502
).
<!-- Eventing configuration with transformation before publish--> <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> <subscription id="mysub1"> <filter source ="synapse/event/test" dialect="http://synapse.apache.org/eventing/dialect/topicFilter"/> <endpoint><address uri="http://localhost:9000/services/SimpleStockQuoteService"/></endpoint> </subscription> </eventSource> <sequence name="PublicEventSource"> <log level="full"/> <xslt key="xslt-key-req"/> <log level="full"/> <eventPublisher eventSourceName="SampleEventSource"/> </sequence> <proxy name="EventingProxy"> <target inSequence="PublicEventSource" /> </proxy> <localEntry key="xslt-key-req" src="file:repository/conf/sample/resources/transform/transform_eventing.xslt"/> </definitions>
In this sample, the event (order request) transform to a new order with different namespace using XSLT Mediator.
Invoke the client (Sender) as follows.
ant eventsender
The event is published after transformation.