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 Formats. This 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.
Set up the prerequisites required for all samples.
Building the sample
Start the WSO2 DAS 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
- Creates three streams with the following IDs:
- Loads the
events-text.csvand related configuration files so that the 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
Open another terminal, go to
<DAS_HOME>/samples/cep/consumers/generic-log-serviceand run the following command:
It builds the servlet web application that logs any HTTP traffic it receives. Events published by the http event publisher are sent to this web application and logged.
Log into the DAS Management Console. Click Tools tab => Event Simulator to open the Event Stream Simulator page. In the Event Stream Name field, select the required event stream. Then click Play for the required file in the Send multiple events section.
The following streams are configured to publish the following event formats via the different pre-configured http event output adapters.
The events received by DAS are logged as follows in the DAS console by the generic-log-service web application.