IoT Events: Publish IoT Topic action with dynamic topic name

0

I'd like to be able to publish a message to a topic, which name is build up dynamically based on one of the input values. I can access to the input already when setting up Transition Events, but can't find a way to interpolate the input value into the topic name.

Suppose I have an input such as: $input.foo = bar Would like to use it in the topic name as: "my/topic/$input.foo", resulting into "my/topic/bar"

Have tried all type of proposed substitution templates w/o success (https://docs.aws.amazon.com/iotevents/latest/developerguide/iotevents-expressions.html)

profile pictureAWS
已提问 2 年前463 查看次数
1 回答
0

Answering to my own question, after some further testing. I did not manage to interpolate the topic dynamically on-the-fly as I wanted. Instead, I found a workaround by declaring a variable that contains the resolved interpolation in a previous state. For instance, the variable leds_topic is initialized with 'gate/' + $input.gate_sensors.gateid + '/leds' Aterwards, I can publish to that topic using as Topic name ($variable.leds_topic)

profile pictureAWS
已回答 2 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则