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

MQTT event receiver is an internal event receiver that comes with WSO2 products. You can configure it with XML, JSON, and text input mapping types.


Follow the steps below before starting the MQTT event receiver configurations.

  1. Configure WSO2 CEP by adding relevant jars to support MQTT transport.

  2. Start the MQTT-supported server.

Creating a MQTT event receiver 

For instructions on creating a MQTT event receiver, see Configuring Event Receivers.

Configuring adapter properties

Specify the Adapter Properties , when creating a MQTT  event receiver using the management console as shown below.

MQTT input event adapter properties

After entering the above adapter properties, select the  Event Stream  to which you want to map the incoming events, and the  Message Format  which you want to apply on the receiving events. Also, click  Advanced  to define custom input mappings based on the  Message Format  you selected. For more information on custom input mapping types, see  Input Mapping Types .

You can also d efine the respective adapter properties of the event receiver based on the transport type within the  <from>  element of the event receiver configuration in the <PRODUCT_HOME>/repository/deployment/server/eventreceivers/ directory as follows.

 <eventReceiver name="mqttEventReceiver" statistics="disable" trace="disable" xmlns="">
    <from eventAdapterType="mqtt">
        <property name="topic">sensordata</property>
        <property name="clientId">CEP-CONSUMER</property>
        <property name="url">tcp://localhost:1883</property>
        <property name="username">mqtt-user</property>
        <property name="password">mqtt-password</property>
        <property name="cleanSession">true</property>

The above adapter properties are described below.

Adapter Property
Configuration file propertyExample


A valid name for the MQTT broker topic which is used to receive messages on the MQTT input event adapter.


Broker Url

MQTT broker URL. You can use the same URL f or WSO2 MB (when offset is zero).


A valid username for the broker connection .

Password A valid password for the broker connection .
Clean Session Persist topic subscriptions and acknowledge positions across client sessions.
Client Id Unique client ID used by the server to identify a client when it reconnects. Used for durable subscriptions or reliable delivery of messages.

Related samples

For more information on  MQTT  event receiver type, see the following sample.

  • No labels