Monday, July 18, 2011

How to send filtered events from WSO2 Complex Event Processing Server to your mail box

Most important thing in complex event processing is the EVENT. It will be very useful if we can direct the filtered events to the email box of the user which the most frequently accessible thing in busy schedules even with their mobile phones.

If we take a simple example:

There is a person with very busy schedule , who used to place trades in Stock market with his mobile phone. But he has to keep his eye open on the stock prices in order to place a profitable order. With this WSO2 Complex Event Processing Server , we can make his life easy. What he has to do is, Configure the WSO2 Complex Event Processing Server to receive events stream from stock market and filter the events which will be worth to trade and send an e mail to the inbox of the user. Once the email is received to the inbox, user would get the alert and he will be able to place an order via his mobile phone.

With WSO2 Complex event processing server, it will be very easy for the user to direct filtered events to his/her mail box. There are only two steps.

Step 01 : Add mail transport sender to the axis2_client.xml file.

In order to do this place the following code segment in axis2_client.xml file in the "Transport Outs " section.

<transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
<parameter name="mail.smtp.from">synapse.demo.0@gmail.com</parameter>
<parameter name="mail.smtp.user">synapse.demo.0</parameter>
<parameter name="mail.smtp.password">mailpassword</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>

Save the file and start the server.

Step 02:

Create the bucket in WSO2 Complex Event Processing server. You can find more information on
that here.

Create the output topic through the "Topics" menu of WSO2 Complex Event Processing Server and create a subscription by providing event sink URL as : "mailto:test@test.com". User can provide his email address here. Once this is done, user will get an email on any filtered event from his
CEP bucket.

No comments:

Post a Comment