⚠️ this port currently supports the "Best Effort" delivery guarantee for incomming events:The reason for this limitation is that the current version of the paho.mqtt.rust library acknowledges a received PUBLISH message automatically before the content of the message is handed over to the application.
If a "At Least Once" delivery guarantee for incommming messages is required, the
cerk_port_mqtt_mosquitto
must be used.
This is a package for CERK. CERK is an open source CloudEvents Router written in Rust with a MicroKernel architecture.
CERK lets you route your CloudEvents between different different ports. Ports are transport layer bindings over which CloudEvents can be exchanged. It is built with modularity and portability in mind.
CERK comes with a couple of prefabricated components, but implementing custom components is easy.
A good overview is provided on GitHub.
This port publishes and/or subscribe CloudEvents to/from an MQTT v3.1 topic.
The port is implemented with a Eclipse Paho MQTT Rust Client and sends and receives messages according to the MQTT Protocol Binding for CloudEvents v1.0 specification
The configurations should be of type cerk::kernel::Config::HashMap
and have at least the entires:
The value has to by of type Config::String
and contain a host name with protocol and port.
E.g. Config::String(String::from("tcp://mqtt-broker:1883"))
The value has to by of type Config::String
and contain the MQTT topic name where the message will be sent to.
E.g. Config::String(String::from("test"))
The following configurations are optional.
The value has to by of type Config::String
and contain the MQTT topic name which the router should subscribe to.
use std::collections::HashMap;
use cerk::kernel::Config;
let map: HashMap<String, Config> = [
("host".to_string(), Config::String("tcp://mqtt-broker:1883".to_string())),
("subscribe_topic".to_string(), Config::String("inbox".to_string())),
("send_topic".to_string(), Config::String("outbox".to_string())),
]
.iter()
.cloned()
.collect();
let config = Config::HashMap(map);
use std::collections::HashMap;
use cerk::kernel::Config;
let map: HashMap<String, Config> = [
("host".to_string(), Config::String("tcp://mqtt-broker:1883".to_string())),
("send_topic".to_string(), Config::String("outbox".to_string())),
]
.iter()
.cloned()
.collect();
let config = Config::HashMap(map);
use std::collections::HashMap;
use cerk::kernel::Config;
let map: HashMap<String, Config> = [
("host".to_string(), Config::String("tcp://mqtt-broker:1883".to_string())),
("subscribe_topic".to_string(), Config::String("inbox".to_string())),
]
.iter()
.cloned()
.collect();
let config = Config::HashMap(map);
The original readme text is a Rust doc comment in the lib.rs file
cargo install cargo-readme
cargo readme > README.md
Apache-2.0