Skip to content

Commit

Permalink
#9 Encoders for MQTT
Browse files Browse the repository at this point in the history
Signed-off-by: Subhobrata Dey <sbcd90@gmail.com>
  • Loading branch information
sbcd90 committed Jan 25, 2021
1 parent 4f39c79 commit f5c3e8a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cloudevents-sdk-paho-mqtt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description = "CloudEvents official Rust SDK - Mqtt integration"
[dependencies]
cloudevents-sdk = { version = "0.3.0", path = ".." }
lazy_static = "1.4.0"
paho-mqtt = "0.8"
paho-mqtt = "0.9.1"
chrono = { version = "^0.4", features = ["serde"] }

[dev-dependencies]
Expand Down
3 changes: 1 addition & 2 deletions cloudevents-sdk-paho-mqtt/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//! This library provides Mqtt protocol bindings for CloudEvents
//! using the [paho.mqtt.rust](https://github.com/eclipse/paho.mqtt.rust) library.\\
//! This library provides Mqtt protocol bindings for CloudEvents using the [paho.mqtt.rust](https://github.com/eclipse/paho.mqtt.rust) library.\\
#[macro_use]
mod headers;
mod mqtt_consumer_record;
Expand Down
8 changes: 5 additions & 3 deletions cloudevents-sdk-paho-mqtt/src/mqtt_producer_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,15 @@ impl MessageBuilderExt for MessageBuilder {

match version {
MQTT_5 => {
self = self.properties(message_record.headers.clone());
self = self.properties(message_record.headers);
}
_ => (),
}

if let Some(s) = message_record.payload.as_ref() {
self = self.payload(s.to_vec());
match message_record.payload {
Some(s) =>
self = self.payload(s),
None => ()
}

self
Expand Down

0 comments on commit f5c3e8a

Please sign in to comment.