Introduction
This sample demonstrates the usage of the UI publisher using a client app. This sample does not have Siddhi queries because it does not not use any execution plans.
Prerequisites
Set up the prerequisites required for all samples
Building the sample
Start the WSO2 CEP server with the sample configuration numbered 0071. For instructions, see Starting sample CEP configurations. This sample configuration does the following.
Creates an event stream named
org.wso2.event.sensor.stream:1.0.0
.Creates an event publisher named
uiPublisher
.Loads the events stored in the
<CEP_HOME>/samples/cep/artifacts/0071/eventsimulatorfiles/events.csv
file to the event simulator.- Deploys a Jaggery application named
outputuitest
. This application functions as the client that consumes the events published by the UI publisher.
Executing the sample
Follow the steps below to execute the sample.
- Access the Analytics Dashboard using the following URL.
https://localhost:9443/portal/
Access the the following page.
https://localhost:9443/portal/outputuitest/index.jag
This opens the following form with the fields filled in with default values as shown below.
The fields in the form are described in the table below.Field Name Description Default Value Stream Name The name of the event stream to which you want to subscribe. When events with values for the attributes defined in this stream are received by the Output Adapter UI test application. org.wso2.event.sensor.stream
Version The version of the event stream to which you want to subscribe. 1.0.0
CEP Host The host on which the CEP server (which contains the UI publisher) runs. localhost
CEP Port The port on which the CEP server (which contains the UI publisher) runs. 9443
Mode UI publisher supports two types of subscriptions named
Websocket
andHTTP
. If you selectWebsocket
for this field, the client application receives events via the Websocket transport. If you selectHTTP
for this field, the client application receives events via the HTTP transport.When the
HTTP
subscription is used, the events are polled from the UI publisher at a constant interval, and this interval needs to be specified in the Polling Interval field.WEBSOCKET
Polling Interval The time interval at which events should be polled from the UI publisher. This time interval is specified in seconds.
This field value is only applicable is the value specified in the Mode field is
HTTP
.30 - Click Connect. Now the client app is ready to receive events. Next step is sending events so the UI publisher receives them and publishes them to the client application.
- Log into the WSO2 CEP Management Console.
- In the Tools tab, click Event Simulator.
- Click Play on the corresponding event stream as shown below to send the events in the
<CEP_HOME>/samples/cep/artifacts/0071/eventsimulatorfiles/events.csv
file to the publisher.
The output events published from WSO2 CEP and received by the client Jaggery application are logged as follows.