WSO2 Complex Event Processor is succeeded by WSO2 Stream Processor. To view the latest documentation for WSO2 SP, see WSO2 Stream Processor Documentation.
||
Skip to end of metadata
Go to start of metadata

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.

  1. Install Apache ActiveMQ JMS event adapter. 

    This guide uses ActiveMQ versions 5.7.0. If you want to use a later version, for instructions on the necessary changes to the configuration steps, go to Apache ActiveMQ Documentation.
  2. Issue the following command from the <ACTIVEMQ_HOME>/bin directory to start ActiveMQ.
    ./activemq console 
  3. Configure WSO2 CEP by adding relevant libraries to support JMS transport

  4. Configure sample client by adding relevant jars. See setting up JMS for JMS sample clients.

  5. Open the  <CEP_HOME>/repository/conf/jndi.properties file and register a connection factory named TopicConnectionFactory by entering the following in the register some connection factories section. And add the topics to be sent to the ActiveMQ broker

     

    connectionfactory.TopicConnectionFactory=amqp: //admin:admin@clientid/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 jmsPublisherMap and jmsPublisherText
  • Loads the events stored in the  <CEP_HOME>/samples/cep/artifacts/0059/eventsimulatorfiles/events.csv  file to the event simulator.

Executing the sample

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

    It subscribes to the ActiveMQ broker under the mentioned topic name.

  2. Play the event.csv file deployed using the Event Simulator. This will send an event flow through the stream to the JMS publisher.

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

  • No labels