Experimental
@aws-cdk/aws-iot-actions-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
MqttQualityOfService Enum
MQTT Quality of Service (QoS) indicates the level of assurance for delivery of an MQTT Message.
| Stability | Experimental |
|---|---|
| Source | lib/iot-republish-action.ts |
Example
ts
new iot.TopicRule(this, 'TopicRule', {
sql: iot.IotSql.fromStringAsVer20160323("SELECT topic(2) as device_id, timestamp() as timestamp, temperature FROM 'device/+/data'"),
actions: [
new actions.IotRepublishMqttAction('${topic()}/republish', {
qualityOfService: actions.MqttQualityOfService.AT_LEAST_ONCE, // optional property, default is MqttQualityOfService.ZERO_OR_MORE_TIMES
}),
],
});
python
iot.TopicRule(self, "TopicRule",
sql=iot.IotSql.from_string_as_ver20160323("SELECT topic(2) as device_id, timestamp() as timestamp, temperature FROM 'device/+/data'"),
actions=[
actions.IotRepublishMqttAction("${topic()}/republish",
quality_of_service=actions.MqttQualityOfService.AT_LEAST_ONCE
)
]
)
java
TopicRule.Builder.create(this, "TopicRule")
.sql(IotSql.fromStringAsVer20160323("SELECT topic(2) as device_id, timestamp() as timestamp, temperature FROM 'device/+/data'"))
.actions(List.of(
IotRepublishMqttAction.Builder.create("${topic()}/republish")
.qualityOfService(MqttQualityOfService.AT_LEAST_ONCE)
.build()))
.build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.IoT.Actions.Alpha
new TopicRule(this, "TopicRule", new TopicRuleProps {
Sql = IotSql.FromStringAsVer20160323("SELECT topic(2) as device_id, timestamp() as timestamp, temperature FROM 'device/+/data'"),
Actions = new [] {
new IotRepublishMqttAction("${topic()}/republish", new IotRepublishMqttActionProps {
QualityOfService = MqttQualityOfService.AT_LEAST_ONCE
}) }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkiotactionsalpha/v2
iot.NewTopicRule(this, jsii.String("TopicRule"), &TopicRuleProps{
Sql: iot.IotSql_FromStringAsVer20160323(jsii.String("SELECT topic(2) as device_id, timestamp() as timestamp, temperature FROM 'device/+/data'")),
Actions: []IAction{
actions.NewIotRepublishMqttAction(jsii.String("${topic()}/republish"), &IotRepublishMqttActionProps{
QualityOfService: actions.MqttQualityOfService_AT_LEAST_ONCE,
}),
},
})
Members
| Member | Description |
|---|---|
ZERO_OR_MORE_TIMES | QoS level 0. |
AT_LEAST_ONCE | QoS level 1. |
Referenced by
IotRepublishMqttActionProps.qualityOfServicequality_of_servicequalityOfServiceQualityOfServiceQualityOfService