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
- Two streams with the IDs
org.wso2.sample.login.info:1.0.0
andorg.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
<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.