Introduction
This sample demonstrates how to filter incoming event attributes and add them to a topic using simple pass-through with JMS adaptor. Because we do not use any execution plan here, there is no Siddhi query.
Prerequisites
- See Prerequisites in CEP Samples Setup page.
- Copy the ActiveMQ JMS related JARs referred in JMS Transport to
<CEP_HOME>/repository/components/lib
directory. - Copy the following JARs from ActiveMQ distribution directory to
<CEP_HOME>/samples/lib
directory.<ActiveMQ_HOME>/activemq-all-5.7.0.jar
<ActiveMQ_HOME>/lib/ geronimo-jms_1.1_spec-1.1.1.jar
Previous Apache ActiveMQ versions may not contain SLF4J related files in the client JAR. Therefore, if you get an error, add SLF4J related JAR file to
<CEP_HOME>/samples/lib/
directory of the samples.
Building the sample
Start the WSO2 CEP server with the sample configuration numbered 0002. For instructions, see Starting sample CEP configurations. This sample configuration does the following:
- Creates
<CEP_HOME>/repository/conf/data-bridge/stream-definitions.xml
file, which is used to create the stream definitions for the sample. - Points the default Axis2 repo to
<CEP_HOME>/sample/artifacts/0002
(by default, the Axis2 repo is<CEP_HOME>/repository/deployment/server
).
Executing the sample
Open a new terminal, go to
<CEP_HOME>/samples/consumers/jms
and run the following command:ant topicConsumer -Dtopic=BasicStockQuotes (Since we are sending events from CEP to a topic called BasicStockQuotes)
It builds and runs the jms consumer.
Do not close this terminal. It is required to keep the server running and receiving events.
Open another terminal, go to
<CEP_HOME>/samples/producers/stock-quote
and run ant -Devents=7 from there to build and run the jms producer.In the terminal opened in step 2, see the jms producer sending sample stock quotes information to the CEP server. Given below is a sample of the sent events.
In the terminal opened in step 1, see the output events received from the CEP.
Shown below an example console output of the consumer, when sending events from the jms producer.
Sample on using WSO2 MB as the JMS message broker