Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions packages/amgi-paho-mqtt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,27 @@ Or the application could be run via the commandline:
asyncfast run amgi-paho-mqtt main:app order-topic
```

## Sending Messages

Messages can be sent from the application via the `message.send` event. The `mqtt` binding of the event controls the
send:

```python
await send(
{
"type": "message.send",
"address": "order-topic",
"headers": [(b"trace-id", b"abc123")],
"payload": b"payload",
"bindings": {"mqtt": {"qos": 1, "retain": False}},
}
)
```

`qos` sets the MQTT QoS level (defaults to `0`), and `retain` marks the message as retained (defaults to `False`). With
MQTT v5, message headers are sent as user properties, with `content-type` mapped to the MQTT content type property.
MQTT v3.1.1 has no way to represent headers, so they are dropped.

## Contact

For questions or suggestions, please contact [jack.burridge@mail.com](mailto:jack.burridge@mail.com).
Expand Down
3 changes: 2 additions & 1 deletion packages/amgi-paho-mqtt/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ dependencies = [
"amgi-common==0.48.0",
"amgi-types==0.48.0",
"paho-mqtt>=2.1.0",
"typing-extensions>=4.15.0; python_full_version<'3.11'",
]
entry-points.amgi_server.amgi-paho-mqtt = "amgi_paho_mqtt:run"
entry-points.amgi_server.amgi-paho-mqtt = "amgi_paho_mqtt:_run_cli"

[dependency-groups]
dev = [
Expand Down
Loading
Loading