Skip to content

Commit ceeb6f5

Browse files
committed
docs: The aws mapper is defined using regular flows
Signed-off-by: Didier Wenzek <didier.wenzek@free.fr>
1 parent 1002029 commit ceeb6f5

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

docs/src/references/mappers/builtin-flows.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,63 @@ Finally, the builtin flow is disabled when replaced by a file with the same name
8989
$ mv /etc/tedge/mappers/az/flows/mea.toml /etc/tedge/mappers/az/flows/mea.toml.disabled
9090
```
9191

92+
Alternatively, a builtin flow can be disabled by simply removing its definition
93+
and keeping the associated `.toml.template` file as a witness.
94+
95+
## The AWS mapper
96+
97+
The AWS mapper behavior is defined by a builtin flow located at `/etc/tedge/mappers/aws/flows/mea.toml`:
98+
99+
```toml
100+
input.mqtt.topics = ["te/+/+/+/+/m/+", "te/+/+/+/+/e/+", "te/+/+/+/+/a/+", "te/+/+/+/+/status/health"]
101+
102+
steps = [
103+
{ builtin = "skip-mosquitto-health-status" },
104+
{ builtin = "add-timestamp", config = { property = "time", format = "unix", reformat = true } },
105+
{ builtin = "limit-payload-size", config = { max_size = 131072 } },
106+
{ builtin = "set-aws-topic", config = { prefix = "aws" } },
107+
]
108+
109+
errors.mqtt.topic = "te/errors"
110+
111+
```
112+
113+
This file can be tuned using the `tedge config` command and the following settings:
114+
115+
- `aws.topics`: the mapper input topics
116+
- `aws.mapper.timestamp`: whether the mapper should add a timestamp or not
117+
- `aws.mapper.timestamp_format`: the date format to be used for the timestamp (`unix` or `rfc-3339`)
118+
- `aws.mapper.mqtt.max_payload_size`: the maximum payload for a message (`131072` by default)
119+
- `aws.bridge.topic_prefix`: the prefix used for the bridge local MQTT topic (`aws` by default)
120+
121+
:::note
122+
For a change of one of these settings to be effective, the AWS mapper has to be restarted:
123+
```
124+
$ sudo tedge config set aws.mapper.timestamp_format rfc-3339
125+
$ sudo systemctl restart tedge-mapper-aws
126+
```
127+
:::
128+
129+
This file can also be manually edited to:
130+
- Change step configurations
131+
- Add or remove steps
132+
- Substitute a JavaScript implementation for the builtin transformation.
133+
134+
:::note
135+
If the builtin flow is updated, then the AWS mapper will not override its content,
136+
even if some `tedge config` settings have been updated. In such a case, the AWS mapper only
137+
update its flow template, i.e. the file `/etc/tedge/mappers/aws/flows/mea.toml.template`.
138+
:::
139+
140+
If other flow definitions are provided along the builtin flow in the `/etc/tedge/mappers/aws/flows/` directory,
141+
then these flows are loaded by the AWS mapper.
142+
143+
Finally, the builtin flow is disabled when replaced by a file with the same name and a `.toml.disabled` extension
144+
145+
```
146+
# Disable the AWS mapper builtin flow:
147+
$ mv /etc/tedge/mappers/aws/flows/mea.toml /etc/tedge/mappers/aws/flows/mea.toml.disabled
148+
```
149+
92150
Alternatively, a builtin flow can be disabled by simply removing its definition
93151
and keeping the associated `.toml.template` file as a witness.

0 commit comments

Comments
 (0)