# MQTT

Category: IoT
|
Runtime: 0.9+
|
Available: Free

# Overview

MQTT node by Kumologica integrates with any MQTT broker platform for publishing the events.

# Setup

# Prerequisites

For MQTT node to work properly, you need to have a MQTT broker instance running on-premise or on cloud.

# Installation

To install the node from designer:

  1. Go to Add more nodes option on the palette section.
  2. Check for the MQTT node and click install.
  3. Once installed, the designer is required to be restarted.

To install the node from CLI:

  1. Go to your project workspace where you can see your package.json file.
  2. Run the below give npm command.
    npm i @kumologica/kumologica-contrib-mqtt

# Technical Details

Properties

  • Message (Optional)
    Message to be published to the MQTT broker platform.
  • Topic (optional)
    MQTT topic to which the event to be published.
  • ClientId (optional)
    Unique Id which identifies the client which published the message to the MQTT topic.
  • Username (optional)
    Username for authenticating with the MQTT broker platform.
  • Password (optional)
    Password for authenticating with the MQTT broker platform.
  • Host (Required)
    Hostname of the MQTT broker to connect.
  • Port (Required)
    Port number of the MQTT broker to connect.
  • ReconPeriod (Optional)
    Reconnection retry interval.
  • Keepalive (Optional)
    Keep alive ensure that the connection between the broker and the client is still open.
  • ProtocolId (Optional)
    MQTT protocol Id.
  • Version (Optional)
    Version of the MQTT protocol to follow.
  • Clean (Optional)
    This enable to clean the session.
  • Encoding (Optional)
    Message encoding default is utf-8.
    512 mb is the minimum memory requirement for your AWS lambda deployment when using MQTT node.

Supported Operations

Throws

MQTT node throws the following exception.

  • MQTT Client Failed

Returns

Payload and variables are not enriched or overwritten by this node.

# Develop a Service

Video tutorial

# Instructions

  1. Drag a drop an EventListener node from the palette to the canvas. Open the settings, configure the following and Save.

    Display Name : POST /send
    Event Source : Amazon API gateway
    Verb : POST
    URL : /send
    
  2. Add a logger from the palette to the canvas and set the Message as msg.payload.

  3. From the iot category add MQTT node to the canvas. Open the settings, configure the following and Save.

    Message : msg.payload 
    Topic : Your topic in MQTT broker
    Host : Your MQTT broker host
    Port : Your MQTT broker port
    
  4. Wire the EventListener node to the Logger node and wire logger node to MQTT node.

  5. Add EventListener End node from the palette to the canvas. Open the settings, configure the following and Save.

    Content-Type : application/json
    Payload : Completed
    
  6. Wire the MQTT node to EventListener End node.

# Try it

Sample Flow for publishing MQTT event to a broker