Introduction
This sample demonstrates how to publish Map and Text events via JMS transport. You consume the published events in WSO2 CEP using a JMS client which is subscribed to ActiveMQ broker.
Prerequisites
Follow the steps below to set up the prerequisites before starting the configuration.
Install Apache ActiveMQ JMS event adapter.
- Issue the following command from the <
ACTIVEMQ_HOME>/bin
directory to start ActiveMQ.
./activemq console
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 ActiveMQ brokerconnectionfactory.TopicConnectionFactory=amqp:
//admin:[email protected]/test?brokerlist='tcp://localhost:5672'
topic.topicMap = topicMap topic.topicText = topicText
Building the sample
Start the WSO2 CEP server with the sample configuration numbered 0059. For instructions, see Starting sample CEP configurations. This sample configuration creates the following:
- A stream with the ID
org.wso2.event.sensor.stream:1.0.0
. - Two event publishers named j
msPublisherMap
andjmsPublisherText
- Loads the events stored in the
<CEP_HOME>/samples/cep/artifacts/0059/eventsimulatorfiles/events.csv
file to the event simulator.
Executing the sample
Open another terminal and navigate to the
<CEP_HOME>/samples/cep/consumers/jms
directory.and run one of the the following commands according to the type of topic name of the messages suppose to consume
ant -Dbroker=activemq -DtopicName=topicMap
ant -Dbroker=activemq -DtopicName=topicTextIt subscribes to the ActiveMQ 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 publisher.You can see the events getting published by CEP by the logs in the jms consumer console.
for Map formatted events:
for Text formatted events: