mqtt-trigger subscribes to MQTT topic(s) and calls an REST APIs
This artefact can be used with every API Management Plus version
- docker 17.06 (and docker-compose)
- MQTT Broker : activemq / rabbitmq / mosquitto / ...
- Policy Engine : Axway API Gateway or custom engine (see [./tests/policy] )
Triggers are set inside mqt-trigger.yml, for example all Messages on topic #simplest are forwarded to API Management. API Endpoint and other Parameters can be modified inside the mqtt-trigger.yml
See Axway API Gateway samples for mqtt in : ./api-gateway-policies/mqtt-trigger-apigw-policy.xml
In API Gateway Policy Studio, please use Import Configuration Fragment to upload the policy
Command Line
mqtt-trigger [OPTIONS]
Usage of ./mqtt-trigger:
-conf string
conffile
-http-headers string
headers ( 'key1 : value1, key2: value2' )
-http-url string
Default prefix for url to forward messages ( http-url + trigger-name)
-mqtt-broker string
Default MQTT broker url (mqtt://)
-mqtt-client-id string
Default prefix to MQTT Client ID (client-id + '-' + trigger-name)
-mqtt-password string
Default MQTT password
-mqtt-username string
Default MQTT usernameTest full environment with docker
docker-compose -f docker-compose.yml up
defaults:
url: http://api:3000/api/topic
headers:
- "Content-Type: application/json"
broker: mqtt://mosquitto:1883
clientid: mqtt-trigger
username: mqtt-trigger
password : goodpass
triggers:
- name: simplest
- name: override
topic: override-topic
url: /override-uri
clientid: override-id
username: override-username
headers:
- "Content-Type: application/json"
- "Override-Header : override-header-value"
- name: all
topic: "all/#"
- name: activemq
topic: activemq/#
broker: mqtt://mosquitto:1883Prerequisites : golang
make install-deps
makedocker build -t mqtt-trigger:dev .
make docker
-or-
docker build -t mqtt-trigger .
make docker-test
{
name: "string",
topic: "string", // Default: <name>
url: "string", // Default (conffile.Defaults.url || conffile.Defaults.url + -mqtt-url["/xxxx"] || -mqtt-url ) <name>
headers: [ "string" ], // Default: "content-type: application/json" || conffile.Defaults.headers || -mqtt-headers
broker: "string", // Default: conffile.Defaults.Broker || -mqtt-broker
clientid: "string", // Default: (conffile.Defaults.ClientID || -mqttclient-id) + <name>)
username: "string", // Default: conffile.Defaults.Username || -mqtt-username
password: "string", // Default: conffile.Defaults.Password || -mqtt-password
}## Limitations
- One Node only !!!! : No distribution across nodes
- ClientID MUST be unique !
- No TLS support for the trigger
- 0.0.4
- add MQTT-TOPIC (replaces TOPIC), MQTT-CLIENT-ID, MQTT-USERNAME, TRIGGER-NAME headers
- 0.0.3
- add TOPIC header to the HTTP Post request
- fix dynamic reload of config
- 0.0.2
- configuration file support with default
- disabled etcd support
- use docker 17.05 for compact build
Please read Contributing.md for details on our code of conduct, and the process for submitting pull requests to us.

