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
asked 6 months ago213 views
1 Answer
1
Accepted Answer

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
answered 6 months ago
profile picture
EXPERT
reviewed 6 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions