You can use wildcards as Routes topics.
Routes
Overview
IoT Routes interconnect your Hub with services that are not publish/subscribe compatible.
Routes subscribe to topics in your Hub and forward the messages’ payloads to other services, automating the process.
You can create and delete Routes in the Routes tab of your Hub in the console. All Routes require a name and a topic to subscribe to. Other settings are specific to the kind of Route you choose.
If your route subscribes to Hub events, routes will drop events they generated themselves in order to avoid message loops. However, you need to make sure messages do not loop between different routes.
REST Route
REST Routes forward your messages to any RESTful API over HTTP or HTTPS.
You can choose the HTTP verb, the API endpoint and HTTP additional headers to be sent. The route will call the API for each received message.
The HTTP headers will contain the verb you configured as well as the message’s topic (X-MQTT-Topic
) and X-MQTT-Retain
which can be true
or false
, depending on whether the message’s retain flag is set or not.
The HTTP request body will contain the message’s payload.
Database Route
Database Routes forward your messages to a database. PostgreSQL and MySQL are currently supported.
You can choose the connection settings and write an SQL query. This query will be executed against the database each time a message is received. The query can contain two variables:
$TOPIC
: the topic of the received message$PAYLOAD
: the payload of the received message
The $TOPIC
and $PAYLOAD
variables cannot be written inside quotes nor can their contents be escaped. They are parameters to the prepared query, not substituted in the query string.
Object Storage Route
Object Storage Routes forward your messages to a Scaleway Object Storage bucket.
You can choose the bucket you want to write to, a path prefix, and one of the two following strategies:
- Per topic: where one topic received equals one object in your bucket. The following messages with the same topic will overwrite previously written objects.
- Per message: where one message received equals one object in your bucket
Depending on the strategy the message payload will be written:
- Per topic: s3://
my-bucket
/my/prefix
/my/topic
- Per message: s3://
my-bucket
/my/prefix
/my/topic
/timestamp
Timestamp example:
2006-01-02T15:04:05.999999999Z
Limits and quotas
Quotas | Limits | |
---|---|---|
Maximum number of Routes per Hub - Shared plan | 100 | |
Maximum number of Routes per Hub - Dedicated plan | 100 | |
Maximum number of Routes per Hub - HA plan | 100 |