Introduction
This sample demonstrates how to publish custom Map and JSON events via JMS transport. Custom events are events with custom mappings that does not adhere to the default event formats. For more information on event formats, see Event Formats . You consume the published events in CEP using aJMS client which is subscribed to Qpid broker.
Prerequisites
Follow the steps below to set up the prerequisites before starting the configuration.
Install JMS-Qpid Broker and JMS-Qpid Client.
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]/default?brokerlist='tcp://localhost:5672'
topic.topicMap = topicMap topic.topicJSON = topicJSON
Start Qpid Broker with ./qpid-server start command by navigating to <QPID-BROKER_HOME>/bin.
Building the sample
Start the WSO2 CEP server with the sample configuration numbered 0060. For instructions, see Starting sample CEP configurations. This sample configuration does the following:
- Changes the default Axis2 repo from
<CEP_HOME>/repository/deployment/server
to<CEP_HOME>/sample/cep/artifacts/0060.
- Creates a stream with id
org.wso2.event.sensor.stream:1.0.0
. - Create event publishers named
jmsPublisherMap
andjmsPublisherText
. - Hot deploys the
event.csv
file along with event configuration xml.
Executing the sample
- Start WSO2 CEP with sample 0060 configurations. For more information, see Starting sample CEP configurations.
Open another terminal, go to
<CEP_HOME>/samples/cep/consumers/jms
and run one of the the following commands according to the type of topic name of the messages suppose to consume
ant -Dbroker=qpid -DtopicName=topicMap
ant -Dbroker=qpid -DtopicName=topicJSONIt subscribes to the Qpid 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 Text formatted events: