This sample demonstrates how to publish custom JSON events via Web Socket transport. This sample does not do any processing on the outgoing event. Events are generated using an input event file and the Event Simulator.
Before starting the output websocket event publisher configuration, set up the prerequisites required for all CEP samples.
Building the sample
Start the WSO2 DAS server with the sample configuration numbered 0069. For instructions, see Starting sample CEP configurations. This sample configuration creates the following.
- An event stream named
- An event publisher named
wsPublisherto fetch events from the configured receiver email address.
- Loads the events stored in the
<DAS_HOME>/samples/cep/artifacts/0069/eventsimulatorfiles/events.csvfile to the Event Simulator.
Executing the sample
Follow the steps below to execute the sample.
Navigate to the
<DAS_HOME>/samples/cep/consumers/websocket/directory, and execute the following Ant command using another tab in the CLI:
ant -Dport=9099 -Dsn=0069The other optional parameters that can be used in the above command are defined in the
This builds the WebSocket client which fetches the published events in the
<DAS_HOME>/samples/cep/artifacts/0069/eventsimulatorfiles/events.csvfile from the
wsPublisherendpoint as shown below.
Log in to the Management Console.
- Click Tools, and then click Event Simulator.
- Click Play on the corresponding event stream as shown below, to send the events in the
<DAS_HOME>/samples/cep/artifacts/0069/eventsimulatorfiles/events.csvfile to the publisher.
You view the WSO2 events that are published to the DAS server in the logs of the consumer terminal as shown below.