WebSocket input event adapter is an internal event adapter that comes with WSO2 products by default. You can configure it with XML, JSON, and text input mapping types.
Prerequisites
Start the WebSocket server, before starting the input adapter configurations.
Creating a WebSocket input event adapter
For instructions on creating a WebSocket input event adapter, see Receiving Events.
Configuring adapter properties
Specify the Adapter Properties, when creating a WebSocket input event adapter using the management console as shown below.
After entering the above adapter properties, select the Event Stream to which you want to map the incoming events, and the Message Format which you want to apply on the receiving events. Also, click Advanced to define custom input mappings based on the Message Format you selected. For more information on custom input mapping types, see Input Mapping Types.
You can also define the respective adapter properties of the event receiver based on the transport type within the <from>
element of the event receiver configuration in the<CEP_HOME>/repository/deployment/server/eventreceivers/
directory as follows.
<eventReceiver name="WebsocketInputEventAdapter" statistics="disable" trace="disable" xmlns="http://wso2.org/carbon/eventreceiver"> <from eventAdapterType="websocket"> <property name="websocket.server.url">ws://localhost:9099</property> <property name="events.duplicated.in.cluster">false</property> </from> ................... </eventReceiver>
The above adapter properties are described below.
Adapter Property | Description | Configuration file property | Example |
---|---|---|---|
Web Socket Server URL | URL of the WebSocket server to which you want to connect to | websocket.server.url | ws://localhost:9099 |
Is events duplicated in cluster | In a cluster whether the same event can reach two receiver nodes | events.duplicated.in.cluster | true/false |