The latest version for DAS is WSO2 Data Analytics Server 3.1.0. View documentation for the latest release.
WSO2 Data Analytics Server is succeeded by WSO2 Stream Processor. To view the latest documentation for WSO2 SP, see WSO2 Stream Processor Documentation.

All docs This doc
Skip to end of metadata
Go to start of metadata


Follow the steps below before starting this MQTT sample configurations.

  1. Set up the prerequisites required for all samples.
  2. Configure WSO2 DAS by adding relevant jars to support MQTT transport.

  3. Configure the sample client by adding the relevant jars. For more information, see setting up MQTT for MQTT sample clients.
  4. Start the MQTT-supported server. (E.g. Mosquitto)

Building the sample 

Start the WSO2 DAS server with the sample configuration numbered 0016. For instructions, see Starting sample CEP configurations.

This sample configuration creates the following.

  • An event stream with the ID
  • An event receiver named mqttEventReceiver to fetch events from the configured MQTT server
  • An event publisher named loggerEventPublisher  to log the received messages.

Executing the sample 

After you view the message upon successful connection to the MQTT-supported server in the WSO2 DAS logs in the CLI, navigate to the <DAS_HOME>/samples/cep/producers/mqtt/ directory, and execute the following Ant command using another tab in the CLI.

ant -Durl=tcp://localhost:1883 -Dtopic=sensordata -Dsn=0016

Replace the value of the Durl parameter in the above command with your MQTT broker URL accordingly. The other optional parameters that can be used in the above command are defined in the <DAS_HOME>/samples/cep/producers/mqtt/build.xml file.

This builds the MQTT client and publishes the events in the  <DAS_HOME>/samples/cep/artifacts/0016/sensordata.txt file to the mqttEventReceiver endpoint. The details of the events that are sent are logged as shown below.

events produced and published to the MQTT broker

The JSON events received by the DAS server are logged as shown below. 

events received by WSO2 CEP via MQTT transport

  • No labels