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 creating 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 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 provided query 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)
$PAYLOAD are both variables of a prepared statements. This means that their respective PostgreSQL types are used:
$PAYLOAD may both appear multiple times in the query.
$PAYLOAD is binary and
$TOPIC is text, all postgresql functions and type conversions can be used to manipulate them. For example, if published payloads are always float values, they can be stored as a float into the database. The payload may also be decoded as JSON if needed. The query will be run by postgres, which means that all the expressiveness offered by postgres is available.
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:
X-MQTT-Topic: topic of the MQTT message
X-MQTT-Retain: Retain flag, which can be either
false. (This feature is not available on
If the HTTP reply contains an HTTP OK status code (2xx) and a
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 . In the Routes page, click Create a Route.
3 . The Add a new Route form 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 a Hub, click on the delete icon next to the route to delete: