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 set up an execution plan with output rate limiting functionality. It uses the following Siddhi query to  output custom events with the last IP addresses received from the loginEvents stream for every 5 events. This has the behavior of emitting a custom event per every 5 events. Custom events are events with custom mappings  that does not adhere to the default event formats. For more information on event formats, see  Event Formats

from loginEvents 
select ipAddress as ip 
output last every 5 events 
insert into uniqueIps;

Prerequisites

Set up the prerequisites required for all samples.

Building the sample

Start the WSO2 CEP server with the sample configuration numbered 0113. For instructions, see    Starting sample CEP configurations . This sample configuration creates the following.
  •   Two streams with the IDs org.wso2.sample.login.info:1.0.0 and org.wso2.sample.out.unique.login:1.0.0
  • An event receiver named loginInfoReceiver.
  • An event publisher named uniqueIpPublisher to log the received messages.
  • An execution plan named UniqueLoginExecutionPlan.

Executing the sample

Navigate to the <CEP_HOME>/samples/cep/producers/http/ directory, and execute the following Ant command using another tab in the CLI:  ant -Durl=http://localhost:9763/endpoints/loginInfoReceiver  -Dsn=0113

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

This builds the HTTP client and publishes the events defined in the <CEP_HOME>/samples/cep/artifacts/0113/loginInfoReceiver.txt file to the loginInfoReceiver endpoint. You view the details of the events that are sent as shown below.

events being sent by the HTTP client

You view the CEP server receiving the output events in the logs of it in the CLI as shown below.

events received by the CEP server

  • No labels