Routes allow your IoT Hub to forward messages to non-MQTT destinations.
Currently the following routes are available:
Scaleway Object Storage is an object storage service provided by Scaleway and based on the S3 protocol.
The purpose of the Scaleway Object Storage Route is to store specific messages (published on a given topic) in a bucket.
Important: It is required to create the Object Storage bucket before creating the Route.
There are two distinct strategies for storing messages:
Messages published on the same topic are stored in the same object (the last message overwriting the previous ones). The object name is composed of the prefix you chose and the topic name.
For example: Publishing to
'hello/world' will create
Each published message is stored in a distinct object. The object name is composed of the prefix you chose, the topic name and the timestamp the message is received on the route.
For example: Publishing to
'hello/world' will create a
When you create a Scaleway Object Storage Route through the Scaleway console, a write permission is automatically granted to the IoT platform for the selected bucket.
> s3cmd setacl s3://<my-bucket> --acl-grant=write:555c69c3-87d0-4bf8-80f1-99a2f757d031:555c69c3-87d0-4bf8-80f1-99a2f757d031
The purpose of the Database Route is to store specific messages (published on a given topic) in a database or to trigger the execution of any other SQL query on the given database. Currently, only PostgreSQL databases are available to use with this Route. You need to create your Database before creating the Route. If you are not yet familiar with creating a Scaleway Elements Database, you can follow the documentation available here.
When the given topic filter is matched, the query you wrote is executed on the given database.
This SQL query can use the two following pre-defined parameters:
Following is an example of the simplest request you can use to write the topic and payload in a pre-existing table «messages»:
INSERT INTO messages (topic, payload) VALUES ($TOPIC, $PAYLOAD)
But you are not limited to binary payloads! You can use all postgresql functions and type conversion to manipulate $TOPIC and $PAYLOAD placeholders. For example, if you know published payloads are always float values, you can store it as a float into the database. You can also manipulate JSON payload, call plsql functions, …
Examples using the advanced features of postgresql are available on the database route tips & tricks page.
The purpose of the REST Route is to forward any messages published on a selected topic to a REST service.
Currently, the supported HTTP Verbs are:
If the HTTP reply is contains an OK status code (2xx) and an
X-MQTT-Topic header, the reply payload will be published to this topic.
Once you have created a Hub, you can add Routes to it.
1 . Click on the Routes tab in the configuration of your hub.
2 . The routes section displays, click Create a Route.
3 . The route configuration displays:
For an Object Storage Route:
For a Database Route:
For a REST Route:
4 . Click Add a new route to confirm.
In the Routes tab of your Hub, click on the delete icon next to the route you want to delete: