Working with WSO2 ESB Event Sink and WSO2 DAS
In this post I am going to point out how to integrate WSO2 ESB and WSO2 DAS to send events from ESB to the DAS server. In order to achieve this I am going to use WSO2 ESB v4.9.0 and WSO2 DAS v 3.0.0.
In wso2 ESB you can publish events through publish event mediator and event sinks. In order to achieve our task first we need to create an event receiver and an event stream at the DAS end. Also we create an event sink at the ESB end, and use publish event mediator to publish our event to the DAS’s event receiver.
Creating an event stream
Log on to DAS server and navigate to streams section as follows.
Creating an Event ReceiverNow we need to create an event receiver to receive the events we send from the ESB end. click on the Receivers tab and you will be navigated to the following page. There you can select the desired event type from the available number of event types. In our scenario we are going to use the wso2event type. Also you select your desired event stream you created earlier.
Creating an Event Sink
Click on the Event Sink tab and you will be navigated to the following page. Fill the relevant data to create the Event Sink.
<proxy xmlns="http://ws.apache.org/ns/synapse" name="ProxyEvent" transports="https,http" statistics="disable" trace="disable" startOnLoad="true"> <target> <inSequence> <publishEvent> <eventSink>testSink</eventSink> <streamName>test</streamName> <streamVersion>1.0.0</streamVersion> <attributes> <meta/> <correlation/> <payload> <attribute name="atr1" type="STRING" defaultValue="" value="testValue"/> <attribute name="atr2" type="STRING" defaultValue="" value="Test Region"/> </payload> <arbitrary/> </attributes> </publishEvent> </inSequence> </target> <description/> </proxy>
Create a proxy as above. You can see that I have used the publishEvent mediator. You include the event sink name, stream name and the stream version. In the attributes you can see we include the metadata, correlation data and payload data.
Now hit the defined proxy and you can browse data in the DAS through the Data Explorer tab. Select the table and search. Then you can see the data we published through our event sink.