Crates.io | cerk_port_mqtt_mosquitto |
lib.rs | cerk_port_mqtt_mosquitto |
version | 0.2.11 |
source | src |
created_at | 2021-01-04 12:44:08.990775 |
updated_at | 2021-01-09 17:51:43.81374 |
description | This is a package for CERK. CERK is an open source CloudEvents Router written in Rust with a MicroKernel architecture. |
homepage | https://github.com/ce-rust/cerk |
repository | https://github.com/ce-rust/cerk |
max_upload_size | |
id | 331622 |
size | 23,404 |
:warning: this port requires a special build of libmosquitto to be present locally:
feat/reliable
branch of https://github.com/ce-rust/mosquittoThe reason for this limitation is that the current version of libmosquitto acknowledges a received PUBLISH message automatically before the content of the message is handed over to the application. This patch needs to stay until this issue is fixed upstream (see https://github.com/eclipse/mosquitto/pull/1932).
This patch could be used by adding the following two parameters to the cargo build command:
MOSQUITTO_GIT_URL=https://github.com/ce-rust/mosquitto
MOSQUITTO_GIT_HASH=9f834dff9095e6731937d5eac767dbaca46491ac
All the docker compose setups use this binary.
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 topic.
The port is implemented with a fork of the Mosquitto Client and sends and receives messages according to the CloudEvents specification (see MQTT Protocol Binding for CloudEvents v1.0).
The reason we are currently using a fork is that the version published on crates.io does currently not support the latest version of libmosquitto. Because we proposed a change to libmostquitto to better support our usecase we need to use the headerfiles of latest version of libmosquitto. The goal is to used the published version at some point because otherwise this port can't be published on crates.io (see https://github.com/ce-rust/cerk/issues/88).
The configurations should be of type cerk::kernel::Config::HashMap
and can have at the following fields:
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 following configurations are optional.
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("inbox"))
The value has to by of type Config::String
and contain the MQTT topic which the router should subscribe to.
E.g. Config::String(String::from("outbox"))
The value has to by of type Config::U8
and contain the quality of service for message delivery.
Currently, the following values are supported:
E.g. Config::U8(1)
This configuration will connect to the broker but will not send or receive any events.
use std::collections::HashMap;
use cerk::kernel::Config;
let map: HashMap<String, Config> = [
("host".to_string(), Config::String("tcp://mqtt-broker:1883".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("inbox".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("outbox".to_string())),
("subscribe_qos".to_string(), Config::U8(1)),
]
.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("inbox".to_string())),
("subscribe_topic".to_string(), Config::String("outbox".to_string())),
("subscribe_qos".to_string(), Config::U8(1)),
]
.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