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.

sc
已提問 1 個月前檢視次數 104 次
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.

sc
已回答 1 個月前
profile picture
專家
已審閱 1 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南