WSO2 Complex Event Processor is succeeded by WSO2 Stream Processor. To view the latest documentation for WSO2 SP, see WSO2 Stream Processor Documentation.
||
Skip to end of metadata
Go to start of metadata

Introduction

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.

Prerequisites

Follow the steps below before starting the output websocket event publisher configuration. 

  1. Set up the prerequisites required for all samples.

Building the sample  

Start the WSO2 CEP server with the sample configuration numbered 0069. For instructions, see Starting sample CEP configurations. This sample configuration creates the following. 

  • An event stream named org.wso2.event.sensor.stream:1.0.0.
  • An event publisher named wsPublisher to fetch events from the configured receiver email address.
  • Loads the events stored in the <CEP_HOME>/samples/cep/artifacts/0069/eventsimulatorfiles/events.csv file to the event simulator.

Executing the sample

Follow the steps below to execute the sample.

  1. Navigate to the <CEP_HOME>/samples/cep/consumers/websocket/ directory, and execute the following Ant command using another tab in the CLI: ant -Dport=9099 -Dsn=0069

    The other optional parameters that can be used in the above command are defined in the <CEP_HOME>/samples/cep/consumers/websocket/build.xml file.

    This builds the WebSocket client which fetches the published events in the <CEP_HOME>/samples/cep/artifacts/0069/eventsimulatorfiles/events.csv file from the wsPublisher endpoint as shown below.

  2. Log in to the management console.

  3. Click Tools, and then click Event Simulator.
  4. Click Play on the corresponding event stream as shown below, to send the events in the <CEP_HOME>/samples/cep/artifacts/0069/eventsimulatorfiles/events.csv file to the publisher.
    simulate sending of events to the WSO2 CEP
    You view the WSO2 events that are published to the CEP server in the logs of the consumer terminal as shown below.
  • No labels