使用AWS re:Post即您表示您同意 AWS re:Post 使用条款

AWS Greengrass: Trouble with MQTT-IPC bridging with 1 Client device -> multiple Core devices

0

I am following this tutorial for MQTT messaging: https://docs.aws.amazon.com/greengrass/v2/developerguide/client-devices-tutorial.html#develop-client-device-subscriber-component

I have 1 Client device associated with 2 Core devices (whereas the tutorial has 1 Client and 1 Core device, my understanding is that one-to-many should work as well). On both Core devices, I've deployed an aws.greengrass.clientdevices.mqtt.Bridge with the following topic mapping:

"mqttTopicMapping": {
      "HelloWorldIotCoreMapping": {
        "topic": "test_topic",
        "source": "LocalMqtt",
        "target": "IotCore"
      },
      "HelloWorldPubsubMapping": {
        "topic": "test_topic",
        "source": "LocalMqtt",
        "target": "Pubsub"
      }
    }

When sending messages using the tutorial's basic_discovery.py script, I run the following command on both Core devices – and see messages being sent. That works great: sudo /greengrass/v2/bin/greengrass-cli iotcore sub -t 'test_topic' Result:

Successfully subscribed to topic: test_topic
{"message": "Hello World! ", "sequence": 0}
{"message": "Hello World! ", "sequence": 1}
...

But - when I re-run the discovery script on Client and run this command on both Core devices, only ONE of the two Core devices outputs the IPC messages sudo /greengrass/v2/bin/greengrass-cli pubsub sub -t 'test_topic'

Why might the MQTT bridge relay be working on only one of the two Core devices? Deployments are identical on both Cores.

I'll call the Core device successfully receiving IPC messages device A, and the Core device receiving MQTT messages (but failing to receive IPC) device B. Something else I noticed — when I go to Core device A's console and disassociate the Client device from device A, the IPC messages immediately start coming up on device B.

Policies and selectionRule in clientdevices.Auth are definitely set correctly.

Also – as a test, I added a third Core device, device C. Now, only device C receives pubsub messages, while all 3 devices continue to receive iotcore messages. It's almost as if the MQTT bridge mapping is working on one of the three Core devices, at random.

I have tried:

  • Reinstalling Greengrass core
  • Restarting Greengrass service
  • Restarting the MQTT / Moquette services
  • Trying the same basic_discovery script on a different client device
  • Resolved; I didn't look at the implementation of basic_discovery.py closely enough, it just takes the first valid IoT endpoint connection and disregards the rest.

已提问 8 个月前243 查看次数
1 回答
1
已接受的回答

Resolved; I didn't look at the implementation of basic_discovery.py closely enough, it just takes the first valid IoT endpoint connection and disregards the rest.

已回答 8 个月前
profile picture
专家
已审核 8 个月前

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

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

回答问题的准则