Skip to content

ako/MqttClient

Repository files navigation

Mendix MQTT connector

Mendix module to send and receive MQTT messages. This module uses the Eclipse Paho library. Tested with AWS IoT, The Things network and mosquitto brokers.

Usage

Main java actions:

  • MqttPublish - publish a message to specified topic
  • MqttSubscribe - subscribe to a topic. Required you to specify a microflow which will be called upon receiving a message. This microflow should have two string parameters: Topic and Payload.
  • MqttUnsubscribe - unsubscribe from topic

MQTT Microflow actions toolbox

Usage with Amazon AWS IoT

You need to register your app as a Thing on AWS IoT. Download the generated certificates and store them in your resources folder of your app. When subscribing or publishing a message specify their location reletive to the resources folder.

Usage with TTN

For TTN you can leave the certificate info empty, instead provide username and password.

Microflow to subscribe to an MQTT topic:

MQTT subscribe to topic

Configuration of subscribe for TTN:

Microflow to handled messages received:

More info can be found here: Using Mendix with TTN

Usage with IBM IoT

To use IBM IOT you need to fill in your organisation ID with your organisation ID. For the Username & Password you need to use the API Key for the username and Authentication Token for password.

IBM IOT

Setting up your IBM Application

To get your API Key and Authentication token login to your IBM IOT Launchpad and click on apps. Then click new Generate New API Key. IBM Apps

Development

Java dependencies are managed using Apache Ivy. There are two configuration:

  • export - this is used to make sure only the required jars for the connector module are in userlib
  • default - this downloads all dependencies required to run the project

Before you export the connector module run runivy-export.cmd to ensure you have the correct set of libraries to be included in the connector mpk.

License

Apache License V2.0

Version history

  • 1.0 - 2016-08-13 - initial release
    • Implementation
    • Fix for subscribing to multiple topics with different microflows
    • Fix to ensure unique client id
  • 1.1 - 2016-12-11 - reconnect
    • Resubscribe on reconnect
    • Upgrade to mendix 6.10.0
    • Use microflow parameter type for subscription onMessageMicroflow
    • More TTN documentation
  • 1.2 - 2017-04-04
    • Added support for IBM Watson