Table of Contents |
---|
Introduction
This sample demonstrates how to set up an execution plan with a basic pass-through query. It selects some of the attributes of each incoming event and emits an output event with the selected attributes. This sample uses wso2event
for both inputs and outputs.
The query used in this sample is as follows:
Code Block |
---|
from InMediationStatsStream select meta_host, timestamp, resource_id, direction, fault_count, count insert into OutMediationStatsStream; |
In the The above query, we are going to process
- Processes the events received through the
...
-
InMediationStatsStream
- Selects the attributes (meta_host, timestamp, resource_id, direction, fault_count, count)
...
- specified under the
select
clause, from each event received. - Emits those events
...
- as output events through the
OutMediationStatsStream
.
Since we are do not doing perform any processing apart from selecting a few attributes, this is considered as a pass-through query.
This sample uses wso2event for both inputs and outputs.
Prerequisites
For a list of prerequisites, please refer to the prerequisites section in Setting up CEP Samples.
...
Prerequisites
See Prerequisites in CEP Samples Setup page.
Building the sample
Start the WSO2 CEP server with the sample
...
configuration numbered 0101. For instructions, see Starting sample CEP configurations. This sample configuration does the following:
- Creates
<CEP_HOME>/repository/conf
...
/stream-manager-config.xml
file, which is used to create the stream definitions
...
- for the sample.
...
- Points the default Axis2 repo
...
- to
...
-
<CEP_HOME>/sample/artifacts/0101
(by default, the Axis2 repo is<CEP_HOME>/repository/deployment/server
)
...
- .
Executing the
...
sample
Open
another terminal and switcha new terminal, go to
This will build<CEP_HOME>/samples/consumers/wso2-event
and run ant from there.
execute
It builds the samplewso2event
consumer andexecutes it.
as itNote Do not close this terminal
in order to receive events and view them. It is required to keep the server running
and receiving events.
From Open another terminal switch , go to
<CEP_HOME>/samples/producers/mediation-stats
/ and run ant from there. This will build and run
It builds and runs thewso2event
producer, which will send some mediation statistics data to the CEP server. From this terminal, you will be able to view the details of the events sentSee the output events received from the CEP via the terminal opened in step 2.
Info title Note To configure host, port, username, password and No. number of events, use -Dhost=xxxx -Dport=xxxx -Dusername=xxxx -Dpassword=xxxx -Devents=xx.
For example : ant -Devents=10
- Once the step 3 is done successfully, you will be able to see the output events received from the CEP via the terminal opened in step 2.
Below is the console For example, given below is a screenshot of the output of the consumer when sending 5 events from the producer.
...
: