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 XML, JSON or custom Text events via HTTP 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 FormatsThis sample does not do any processing on the outgoing event. Use log event publisher, and log the published event to verify if the messages have been properly published.

Prerequisites

Set up the prerequisites required for all samples.

Building the sample 

Start the WSO2 CEP server with the sample configuration numbered 0062. 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/0062
  • Creates three streams with the following ids:
    • org.wso2.event.transaction.stream:1.0.0
    • org.wso2.event.keyword.stream:1.0.0
    • org.wso2.event.message.stream:1.0.0
  • Loads the events-xml.csv, events-json.csv, events-text.csv and related configuration files so that event simulator can be used to send events to the three different pre-configured event publishers.
  • Creates the following three event publishers to log the received messages via an HTTP servlet receiver:
    • httpXml - Publishes events in default XML event format
    • httpJson - Publishes events in default JSON event format
    • httpText - Publishes the event as a customized text message

Executing the sample

  1. Open another terminal, go to <CEP_HOME>/samples/cep/consumers/generic-log-service and run the following command:

        ant -Dsn=0062

    It builds the servlet web application that logs any HTTP traffic it receives. Events published by the http event publisher will be sent to this web application and logged. 

  2. Go to the management console of CEP and determine the required stream and select 'Play' to play the events.
    The following streams are configured to publish the following event formats via the different pre-configured http event output adapters.
    • org.wso2.event.transaction.stream:1.0.0 - XML - via httpXml event publisher
    • org.wso2.event.keyword.stream:1.0.0 - JSON - via httpJson event publisher
    • org.wso2.event.message.stream:1.0.0 - Text - via httpText event publisher
  3. You can see the events getting received by CEP by the logs printed in the CEP console by the generic-log-service web application

  • No labels