Introduction
This sample demonstrates how to publish map and XML events via JMS transport. You consume the published events in CEP using a JMS client which is subscribed to WSO2 Message Broker. This sample does not do any processing on the outgoing 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.0.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. And add the topics to be sent to the Qpid broker.connectionfactory.TopicConnectionFactory=amqp:
//admin:[email protected]/carbon?brokerlist='tcp://localhost:5672'
topic.topicMap = topicMap topic.topicXML = topicXML
Building the sample
Start the WSO2 CEP server with the sample configuration numbered 0061 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 0061 -DportOffset=1 -Dqpid.dest_syntax=BURL
- Changes the default Axis2 repo from
<CEP_HOME>/repository/deployment/server
to<CEP_HOME>/sample/artifacts/0061
- Creates a stream with id org.wso2.event.sensor.stream:1.0.0.
- Create and event publisher namely jmsPublisherMap, jmsPublisherXML
- Hot deploys event.csv file along with event configuration xml
Executing the sample
- Start WSO2 CEP with sample 0061 configurations. For more information, see Starting sample CEP configurations.
Open two separate terminals for
<CEP_HOME>/samples/cep/consumers/jms
,and run the following commands according to the type of topic name of the messages suppose to consumeant -Dbroker=mb -DtopicName=topicMap
ant -Dbroker=mb -DtopicName=topicXMLIt subscribes to the WSO2 Message Broker under the mentioned topic name.
Play the
event.csv
file deployed using the Event Simulator. This will send an event flow through the stream to the JMS publishers.You can see the events getting published by CEP by the logs in the jms consumer console.
for Map formatted events:
for XML formatted events: