-
Notifications
You must be signed in to change notification settings - Fork 65
feat: tedge connect to c8y mqtt service endpoint #3707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 4 commits
40d34b4
9979965
4a980a0
8675e0f
64467ab
813f335
86654d9
6c8700b
0a06606
015ee3d
b25610a
7a4975c
b5d55b1
702e370
510ca24
a1098e8
ad03d81
9d4ebb0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ use super::models::SoftwareManagementApiFlag; | |
use super::models::TemplatesSet; | ||
use super::models::TopicPrefix; | ||
use super::models::HTTPS_PORT; | ||
use super::models::MQTT_SVC_TLS_PORT; | ||
use super::models::MQTT_TLS_PORT; | ||
use super::tedge_config_location::TEdgeConfigLocation; | ||
use crate::models::AbsolutePath; | ||
|
@@ -226,6 +227,10 @@ define_tedge_config! { | |
#[tedge_config(reader(private))] | ||
url: ConnectUrl, | ||
|
||
/// Cumulocity tenant ID | ||
#[tedge_config(example = "t12345678")] | ||
tenant_id: String, | ||
|
||
/// The path where Cumulocity root certificate(s) are stored | ||
#[tedge_config(note = "The value can be a directory path as well as the path of the certificate file.")] | ||
#[tedge_config(example = "/etc/tedge/c8y-trusted-root-certificates.pem", default(function = "default_root_cert_path"))] | ||
|
@@ -433,6 +438,28 @@ define_tedge_config! { | |
#[tedge_config(example = "60m", default(from_str = "60m"))] | ||
interval: SecondsOrHumanTime, | ||
}, | ||
|
||
mqtt_service: { | ||
/// Wheather to connect to the MQTT service endpoint or not | ||
#[tedge_config(example = "true", default(value = false))] | ||
enabled: bool, | ||
|
||
/// MQTT service endpoint for the Cumulocity tenant, with optional port. | ||
#[tedge_config(example = "mqtt.your-tenant.cumulocity.com:1234")] | ||
#[tedge_config(default(from_optional_key = "c8y.url"))] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this not better derived from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolved by 015ee3d |
||
url: HostPort<MQTT_SVC_TLS_PORT>, | ||
|
||
/// The topic prefix that will be used for the Cumulocity MQTT service endpoint connection. | ||
/// For instance, if set to "c8y-mqtt", then messages published to `c8y-mqtt/xyz` | ||
/// will be forwarded to the MQTT service endpoint on the `xyz` topic | ||
#[tedge_config(example = "c8y-mqtt", default(function = "c8y_mqtt_service_topic_prefix"))] | ||
topic_prefix: TopicPrefix, | ||
|
||
/// Set of MQTT topics the bridge should subscribe to on the Cumulocity MQTT service endpoint | ||
#[tedge_config(example = "incoming/topic,another/topic,test/topic")] | ||
#[tedge_config(default(value = "$demo/$error"))] | ||
topics: TemplatesSet, | ||
} | ||
}, | ||
|
||
#[tedge_config(deprecated_name = "azure")] // for 0.1.0 compatibility | ||
|
@@ -1114,6 +1141,10 @@ fn c8y_topic_prefix() -> TopicPrefix { | |
TopicPrefix::try_new("c8y").unwrap() | ||
} | ||
|
||
fn c8y_mqtt_service_topic_prefix() -> TopicPrefix { | ||
TopicPrefix::try_new("c8y-mqtt").unwrap() | ||
} | ||
|
||
fn az_topic_prefix() -> TopicPrefix { | ||
TopicPrefix::try_new("az").unwrap() | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.