Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

MQTT event adaptor adapter is an internal event adaptor adapter that comes with WSO2 CEPproducts

Excerpt
hiddentrue

NOTE TO WRITERS: Add the TOC here.

Table of Contents
maxLevel3

Prerequisites

Follow the steps below before starting the input MQTT event adaptor adapter configuration.

  1. Download the MQTT client library (mqtt-client-0.4.0.jar).
  2. Add the file to <PRODUCT_HOME>/repository/components/lib/ directory.

Configuring

...

input MQTT

...

event adapter

You can configure the input MQTT adaptor adapter using the management console or using an xml a configuration file.

Anchor
Using the management console
Using the management console
Configure using the management console

Follow the instructions below to configure input MQTT event adapter using the management console. This deploys the event adapter in the <PRODUCT_HOME>/

repository/deployment/server/inputeventadaptors/ directory.

  1. Log in to the CEP product's management console, and click go to Configure -->  Configure.
  2. Click Input Event Adaptors in the Event Processor Configs --> Input Event Adaptors and menu, and then click Add Input Event AdaptorT hen select 'mqtt' as the Event Adaptor Type
    Enter details in the form that appears and click Add Event Adaptor button at the end of the form. For example,
    Image Removed
    Following values are used in the configuration above (For example):
    No Format
    Event Adaptor Name : mqttInputEventAdaptor
    Event Adaptor Type : mqtt
    Broker Url : tcp://localhost:1883
    Clean Session : true
    Keep Alive : 70000
  3. After a adapter is successfully added, if you need, you can change its configuration and redeploy it. To do this, click the Edit link associated with it. You can also click the other links associated with it to delete it or enable statistics and tracing.
  4. An XML based editor opens allowing you to edit the event adaptor configuration from UI itself, without having to edit the file in the file system. Do your modifications and click Update.
  5. Alternatively, you can specify an event adaptor configuration using an XML file and save it in <PRODUCT_HOME>/repository/deployment/server/inputeventadaptors directory, which is the Input event adaptor deployment directory. Since hot deployment is enabled, you can simply add/remove files to deploy/undeploy from the server. 
      
    Create the
  6. Enter details as shown in the below example. 

    create input MQTT event adapterImage Added

  7. Click  Add Event Adaptor.

Anchor
Using a configuration file
Using a configuration file
Configure using a configuration file

Follow the instructions below to configure input MQTT event adapter using a configuration file.

  1. Create an XML file with the following MQTT input event adaptor adapter configurations. Input event adaptor adapter implementation must start with <inputEventAdaptor> root <inputEventAdaptor> as the root element.

    Code Block
    languagehtml/xml
    <inputEventAdaptor name="mqttInputEventAdaptor" statistics="disable"
      trace="disable" type="mqtt" xmlns="http://wso2.org/carbon/eventadaptormanager">
      <property name="cleanSession">true</property>
      <property name="url">tcp://localhost:1883</property>
      <property name="keepAlive">70000</property>
    </inputEventAdaptor>
  2. Add the XML file to the <PRODUCT_HOME>/repository/deployment/server/inputeventadaptors/ directory. Since hot deployment is enabled, you can simply add/remove files to deploy/undeploy to/from the server.  

Configuring Input MQTT Event Adaptor Message Properties

...

Info

After an adapter is successfully added, it gets added to the list of adapters displayed under Event Processor Configs in the Configure menu of the product's management console. Click Edit to change its configuration and redeploy it. This opens an XML-based editor allowing you to edit the event adapter configurations from the UI.  Do your modifications and click Update. You can also delete it, enable/disable statistics or enable/disable tracing on it using the provided options in the UI.

Configuring input MQTT event adaptor message properties

The configured input event adapters are used in event builders. With input event adaptor message properties, event builders are able to extract data from the incoming events to build the event streams. Following are the Input MQTT Event Adaptor specific message properties.

Image Removed

Topic :

the specific message properties of input MQTT event adapter.

input MQTT event adapter message propertiesImage Added

The message properties of the input MQTT event adapter are described below.
PropertyDescription
TopicThe topic that will be used to receive messages on
the mqttInputAdaptor
the MQTT input adapter
Client Id
:
Unique client
id
ID used for communication
(
. You cannot have duplicated client
ids
IDs for the same
mqtt
MQTT broker
)
.
Input Mapping Type
:
The incoming event type to be mapped.
The Input JMS Event Adaptor supports XML, Json and text mappings.