Skip to content

Commit abfd325

Browse files
authored
Merge pull request #2420 from PradeepKiruvale/qos0
use qos 0 when publishing to c8y/s/uat to request a Cumulocity IoT token
2 parents 9dea122 + 7250a07 commit abfd325

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

crates/core/c8y_api/src/http_proxy.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ impl C8yMqttJwtTokenRetriever {
132132
for _ in 0..3 {
133133
mqtt_con
134134
.published
135-
.publish(mqtt_channel::Message::new(
136-
&Topic::new_unchecked("c8y/s/uat"),
137-
"".to_string(),
138-
))
135+
.publish(
136+
mqtt_channel::Message::new(&Topic::new_unchecked("c8y/s/uat"), "".to_string())
137+
.with_qos(mqtt_channel::QoS::AtMostOnce),
138+
)
139139
.await?;
140140
info!("JWT token requested");
141141

crates/core/tedge/src/cli/connect/bridge_config_c8y.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ impl From<BridgeConfigC8yParams> for BridgeConfig {
5959
r#"alarm/alarms/create out 2 c8y/ """#.into(),
6060
r#"error in 2 c8y/ """#.into(),
6161
// c8y JWT token retrieval
62-
r#"s/uat out 2 c8y/ """#.into(),
63-
r#"s/dat in 2 c8y/ """#.into(),
62+
r#"s/uat out 0 c8y/ """#.into(),
63+
r#"s/dat in 0 c8y/ """#.into(),
6464
];
6565

6666
let templates_set = smartrest_templates
@@ -199,8 +199,8 @@ fn test_bridge_config_from_c8y_params() -> anyhow::Result<()> {
199199
r#"alarm/alarms/create out 2 c8y/ """#.into(),
200200
r#"error in 2 c8y/ """#.into(),
201201
// c8y JWT token retrieval
202-
r#"s/uat out 2 c8y/ """#.into(),
203-
r#"s/dat in 2 c8y/ """#.into(),
202+
r#"s/uat out 0 c8y/ """#.into(),
203+
r#"s/dat in 0 c8y/ """#.into(),
204204
// Smartrest templates should be deserialized as:
205205
// s/uc/template-1 (in from localhost), s/uc/template-1
206206
// s/dc/template-1 (out to localhost), s/dc/template-1

crates/core/tedge/src/cli/connect/command.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,12 @@ fn check_device_status_c8y(tedge_config: &TEdgeConfig) -> Result<DeviceStatus, C
259259
match event {
260260
Ok(Event::Incoming(Packet::SubAck(_))) => {
261261
// We are ready to get the response, hence send the request
262-
client.publish(C8Y_TOPIC_BUILTIN_JWT_TOKEN_UPSTREAM, AtLeastOnce, false, "")?;
262+
client.publish(
263+
C8Y_TOPIC_BUILTIN_JWT_TOKEN_UPSTREAM,
264+
rumqttc::QoS::AtMostOnce,
265+
false,
266+
"",
267+
)?;
263268
}
264269
Ok(Event::Incoming(Packet::PubAck(_))) => {
265270
// The request has been sent

crates/core/tedge/src/cli/connect/jwt_token.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ pub(crate) fn get_connected_c8y_url(tedge_config: &TEdgeConfig) -> Result<String
3333
match event {
3434
Ok(Event::Incoming(Packet::SubAck(_))) => {
3535
// We are ready to get the response, hence send the request
36-
client.publish(C8Y_TOPIC_BUILTIN_JWT_TOKEN_UPSTREAM, AtLeastOnce, false, "")?;
36+
client.publish(
37+
C8Y_TOPIC_BUILTIN_JWT_TOKEN_UPSTREAM,
38+
rumqttc::QoS::AtMostOnce,
39+
false,
40+
"",
41+
)?;
3742
}
3843
Ok(Event::Incoming(Packet::PubAck(_))) => {
3944
// The request has been sent

0 commit comments

Comments
 (0)