Introduction
This sample demonstrates how to filter incoming event attributes sent out from CEP to an email client using simple pass-through with HTTP and Email event adaptors. Because we do not use any execution plan here, there is no Siddhi query.
Prerequisites
- See Prerequisites in CEP Samples Setup page. (copy apache axiom.jar to
<CEP_HOME>/samples/lib
directory to send XML event types) Uncomment the mail transport sender configuration as follows in
<CEP_HOME>/repository/conf/axis2/axis2_client.xml
file to send events to email client.<transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender"> <parameter name="mail.smtp.from">wso2cep.demo@gmail.com</parameter> <parameter name="mail.smtp.user">wso2cep.demo</parameter> <parameter name="mail.smtp.password">wso2cep@123</parameter> <parameter name="mail.smtp.host">smtp.gmail.com</parameter> <parameter name="mail.smtp.port">587</parameter> <parameter name="mail.smtp.starttls.enable">true</parameter> <parameter name="mail.smtp.auth">true</parameter> </transportSender>
See Output Email Event Adaptor for values of the properties.
Building the sample
- Start the WSO2 CEP server with the sample configuration numbered 0005. For instructions, see Starting sample CEP configurations. This sample configuration does the following:
- Creates
<CEP_HOME>/repository/conf/data-bridge/stream-definitions.xml
file, which is used to create the stream definitions for the sample. - Points the default Axis2 repo to
<CEP_HOME>/sample/artifacts/0005
(by default, the Axis2 repo is<CEP_HOME>/repository/deployment/server
).
- Creates
Executing the sample
Since your consumer is an email client, set the values for email address in the event formatter of this sample (by default, the email is sent to wso2cep.demo@gmail.com).
Open another terminal, go to
<CEP_HOME>/samples/producers/pizza-shop
and run the command below.
It builds and runs the pizza order producer, which sends sample pizza order information to the CEP server.ant pizzaOrderClient -Durl=http://localhost:9763/endpoints/httpInputEventAdaptor/PizzaOrder
On this terminal output, see the events sent. For example,
See the output events received from the CEP via the email client.
Notice a WARN log in CEP, which appears because an event sent by the producer is in a wrong format (this is intentionally added to check whether default values are picked by CEP itself).
Shown below is a screenshot of the email client when receiving events from CEP.