1.1 Typical Use Cases
The connector consists of microflow actions that enable doing the following:
- Determining devices connected to AWS IoT
- Getting and setting the shadow of devices connected to AWS IoT through the REST API or MQTT messages
This connector uses source code from the following projects:
The microflow actions need AWS credentials. Most use an AWS access key ID and an AWS secret access key.
For the MQTT actions you need to provide the certificates as provided by AWS IoT. These should be stored in the resources folder of your Mendix app project:
To get a list of all the things registered at AWS IoT, you can use Things - get list action:
This will return a JSON document as provided by AWS IoT. Then you can use a JSON import mapping to create entities from the JSON that is returned.
To get the details of a device, you can use the Thing - describe action:
AWS IoT has a shadow of the device state, and it provides a REST API to this shadow. Through this API, you can determine the last known state of a device or request a state change of the device.
To read the last known status of a device, use the Data - get shadow action:
This action needs the endpoint of the REST API. You can copy-paste this from AWS IoT, or you can use the Thing - get endpoint action to determine the endpoint:
To change the status of a device, you can update the shadow using the Data - change shadow action:
In addition to the REST API, you can work with the state of devices through MQTT messages.
To receive messages from devices, you need to subscribe to the required topic using the Data - subscribe to MQTT topic action:
Typically, you should do this when your Mendix app is started.
To subscribe, you need to provide the certificate information as provided by AWS IoT:
When a message is received, the microflow you specify is called using the
payload string parameters. The
payload contains a JSON document that you can import using JSON import mappings. The format of this message depends on the data sent by the device.
To publish a message on an MQTT topic, you can use the Data - publish MQTT message action:
When configuring this action, you also need the certificates provided by AWS IoT:
3 Developing This Marketplace Component
To contribute to the development of this connector, follow these steps:
- All Java .jar dependencies are managed using an Ivy file. Download all the dependencies by first running
runivy.cmd, which downloads all the .jar files required for running and testing the project into the userlib folder.
- After validating everything works, run
runivy-export.cmd, which will delete all the .jar files in the userlib folder and only download those .jar files required for creating the connector .mpk.