Child pages
  • Sample 0002 - Simple Pass-through with JMS

This documentation is for WSO2 CEP 3.1.0. View the home page of the latest release.

||
Skip to end of metadata
Go to start of metadata

Introduction

This sample demonstrates how to filter incoming event attributes and add them to a topic using simple pass-through with JMS adapter. Because we do not use any execution plan here, there is no Siddhi query.

Prerequisites

  1. See Prerequisites in CEP Samples Setup page.
  2. Copy the ActiveMQ JMS related JARs referred in JMS Transport to <CEP_HOME>/repository/components/lib directory.
  3. 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

    Start the ActiveMQ server before the CEP server starts.

    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

  1. 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.

  2. 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.

  3. 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.

  4. 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

  • No labels