Introduction
This sample demonstrates how to publish JSON events via SMS transport. This sample does not do any processing on the outgoing event. Events are generated using an input event file and an SMSC simulator.
Prerequisites
Follow the steps below to complete the prerequisites before starting the configuration.
Add the following configuration under Transport Outs section in the
<CEP_HOME>/repository/conf/axis2/axis2_client.xml
file, to enable SMS transport.<axisconfigname="AxisJava2.0"> ... <transportSender class="org.apache.axis2.transport.sms.SMSSender" name="sms"> <parameter name="systemType"></parameter> <parameter name="systemId">cep1</parameter> <parameter name="password">cep123</parameter> <parameter name="host">localhost</parameter> <parameter name="port">2775</parameter> <parameter name="phoneNumber">CEP1</parameter> </transportSender> ... </axisconfig>
Configure WSO2 CEP by adding relevant jars to support SMS transport.
Building the sample
Start the WSO2 CEP server with the sample configuration numbered 0065. For instructions, see Starting sample CEP configurations. This sample configuration creates the following.
- An event stream with the ID
org.wso2.event.sensor.stream:1.0.0
- An event publisher named
smsEventPublisher
to fetch events from the configured receiver email address - Load the events stored in the
<CEP_HOME>/samples/artifacts/0065/eventsimulatorfiles/events.csv
file to the event simulator.
Executing the sample
Follow the steps below to execute the sample. This sample uses Logica SMSC Simulator to receive messages. To start messaging simulator clone this repository and follow ReadMe to build it.
Navigate to
build/jar
directory in theSMSC Simulator
repository. The folder must contain following two files.smscsim.jar
users.txt
Add the following name-value pairs to
users.txt
file.Enter the value of the systemId parameter defined in the above SMS transport sender configuration as the value of the name parameter in the below list. Please note that white spaces aren't removed from neither attribute name and it's value,
i.e. "name=peter" and "name= peter" define two different users, "peter" and " peter".name=cep1 password=cep123 timeout=unlimited
- Start SMSC Simulator by executing the following command:
java -cp smscsim.jar:../../lib/smpp.jar
com.logica.smscsim.Simulator
- In the simulator console where the command runs:
- Enter 1 for the prompt to start simulation.
Enter 2775 as the port number (this port is equal to the port defined in the SMS transport sender configuration.)
Starting listener... started
log is displayed on the console, the SMSC simulator is ready to accept messages as shown below. Start the WSO2 CEP server with the sample configuration numbered 0065. For instructions, see Starting sample CEP configurations.
- Click Tools, and then click Event Simulator.
- Click Play on the corresponding event stream as shown below, to send the events in the
<CEP_HOME>/samples/artifacts/0058/eventsimulatorfiles/events.csv
file to the publisher.
You view the JSON events that are published by the CEP server in the logs of the simulator as shown below.
Enter 5 to view the list of messages published from WSO2 CEP as shown below.