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 receive incoming JSON, XML  events adheres WSO2 Event format via jms transport. Here we do not do any processing on the incoming event and to verify the messages we use log event publisher to log the received event.

Prerequisites

Follow the steps below to set up the prerequisites before starting the configuration.

  1. Install JMS-Qpid Broker and JMS-Qpid Client. Start the JMS-Qpid Broker before running this sample.

  2. Configure WSO2 CEP by adding relevant libraries to support JMS transport.

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

  4. 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. ( the "default" is the name of the virtually hosted node in Qpid)
     

     

    connectionfactory.TopicConnectionFactory=amqp://admin:[email protected]/default?brokerlist='tcp://localhost:5672'

    By default jndi.properties file may contain a connection factory named TopicConnectionFactory. You can simply replace it with above to register for Qpid as shown below.

    # register some connection factories
    # connectionfactory.[jndiname] = [ConnectionURL]

    connectionfactory.TopicConnectionFactory=amqp://admin:[email protected]/default?brokerlist='tcp://localhost:5672'

  5. Start JMS-Qpid Broker using command 'bin\qpid-server' from Qpid Broker home.

Building the sample 

Start the WSO2 CEP server with the sample configuration numbered 0012. 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>/samples/cep/artifacts/0012
  • Creates a stream named org.wso2.event.sensor.stream:1.0.0.
  • Creates three event receivers named jmsReceiverJSONjmsReceiverText, and jmsReceiverXML.
  • Creates an event publisher named jmsLogger to log the received messages.

Executing the sample

  1. Wait until the CEP terminal prompts a message similar as follows.

  2. Open another terminal, go to <CEP_HOME>/samples/cep/producers/jms

    and run one of the  the following commands according to the type of event format to be published:

    ant -DtopicName=topicMap -Dformat=map -Dbroker=qpid -Dsn=0012
    ant -DtopicName=topicXML -Dformat=xml -Dbroker=qpid -Dsn=0012

    It builds the jms client and publishes the events at  <CEP_HOME>/samples/cep/artifacts/0012/topicMap.csv and topicXML.txt to the jms receiver endpoint.

  3. You can see the events getting received by CEP by the logs in its console.

    for Map formatted events: 


    for XML formatted events:
     

  • No labels