Introduction
This sample demonstrates how to receive incoming Map, Text events adheres WSO2 Event format via jms transport. Here we do not do any processing on the incoming event and to verify the messages we use log event publisher to log the received event.
Prerequisites
Follow the steps below to set up the prerequisites before starting the configuration.
Before you configure the WSO2 CEP:
- Start WSO2 MB 3.1.0
Configure WSO2 CEP by adding relevant libraries to support JMS transport.
Configure sample client by adding relevant jars. See setting up JMS for JMS sample clients.
Open the
<CEP_HOME>/repository/conf/jndi.properties
file and register a connection factory namedTopicConnectionFactory
by entering the following in theregister some connection factories
section.connectionfactory.TopicConnectionFactory=amqp:
//admin:[email protected]/carbon?brokerlist='tcp://localhost:5672'
Building the sample
Start the WSO2 CEP server with the sample configuration numbered 0013 with an off-port since the WSO2 MB has started in the default port. For instructions, see Starting sample CEP configurations and append -DportOffset=1 -Dqpid.dest_syntax=BURL
to the command as follows.
./wso2cep-samples.sh -sn 0013 -DportOffset=1 -Dqpid.dest_syntax=BURL
This sample configuration does the following:
- Changes the default Axis2 repo from
<CEP_HOME>/repository/deployment/server
to<CEP_HOME>/samples/cep/artifacts/0013
- Creates a stream with id
org.wso2.event.sensor.stream:1.0.0
. - Create two event receivers named
jmsReceiverMap
andjmsReceiverText
. - Create and event publisher to log the received messages with name jmsLogger.
portOffset=1
property, the ports used in CEP server are offset by 1 to avoid port conflicts with MB- forcing the usage of Binding URL(BURL) address syntax by setting
qpid.dest_syntax system
property toBURL
.
Executing the sample
Wait until the CEP terminal prompts a message similar as follows.
Open another terminal and navigate to the
<CEP_HOME>/samples/cep/producers/jms
directory.and run one of the the following commands according to the type of event format to be published:
ant -DtopicName=topicMap -Dformat=map -Dbroker=mb -Dsn=0013
ant -DtopicName=topicText -Dformat=text -Dbroker=mb -Dsn=0013It builds the jms client and publishes the events at
<CEP_HOME>/samples/cep/artifacts/0013/topicMap.csv
andtopicText.txt
to the jms receiver endpoint.You can see the events getting received by CEP by the logs in its console.
for Map formatted events:
for Text formatted events: