Greengrass IPC to IoT Core in low/no connectivity regions

0

When an IoT message is sent, via IPC channel (MQTT proxy), but greengrass is not connected to the internet, are the messages discarded?

    accessControl:
      aws.greengrass.ipc.mqttproxy:
        com.savic.Telemetry:pub:0:
          policyDescription: Allows access to publish to telemetry topic
          operations:
            - aws.greengrass#PublishToIoTCore
          resources:
            - device/dev/telemetry/events
            - device/prod/telemetry/events

try:
        op = ipc_client.new_publish_to_iot_core()
        op.activate(model.PublishToIoTCoreRequest(
            topic_name=TELEMETRY_TOPIC,
            qos=model.QOS.AT_LEAST_ONCE,
            payload=json.dumps(message).encode(),
        ))

        try:
            op.get_response().result(timeout=TIMEOUT)
        except:
            pass

Does GG keep them, then send them later, when there is connectivity, or is this something we have to handle in our component?

Sash
질문됨 2년 전535회 조회
2개 답변
0

Hi Sash. There is an MQTT spooler. https://docs.aws.amazon.com/greengrass/v2/developerguide/configure-greengrass-core-v2.html#configure-mqtt https://docs.aws.amazon.com/greengrass/v2/developerguide/greengrass-nucleus-component.html

spooler (Optional) The MQTT spooler configuration for the Greengrass core device. This object contains the following information:

maxSizeInBytes (Optional) The maximum size of the cache where the core device stores unprocessed MQTT messages in memory. If the cache is full, the core device discards the oldest messages to add new messages.

Default: 2621440 (2.5 MB)

keepQos0WhenOffline (Optional) You can spool MQTT QoS 0 messages that the core device receives while its offline. If you set this option to true, the core device spools QoS 0 messages that it can't send while it's offline. If you set this option to false, the core device discards these messages. The core device always spools QoS 1 messages unless the spool is full.

Default: false

profile pictureAWS
전문가
Greg_B
답변함 2년 전
  • Thank you Greg - This is great. I haven't configured Nucleus as yet - Nucleus is obviously running, as part of the GG runtime (GG is Nucleus). What is the best way to configure it? Through the deployment of "Public Components -> aws.greengrass.Nucleus", and then configure it that way? and "wrap it up" as part of a targeted deployment for a newly added device within that "Thing Group"?

    Additional question:

    If GG (Nucleus) is rebooted - or the device is rebooted, do those messages get lost? seems that the spooler caches the messages in-memory - does it offload it onto the disk by any chance? I'm assuming that can be done via Deployments anyway...

  • There's a few options. Without knowing your use case, I couldn't say what the best way is, but please take a look at custom provisioning: https://docs.aws.amazon.com/greengrass/v2/developerguide/custom-provisioning.html . Yes the spooler is in-memory, so messages would be lost in that scenario. Please add your +1 to this GitHub issue: https://github.com/aws-greengrass/aws-greengrass-nucleus/issues/825

0

Wanted to update this answer as there has been a feature release with GG V2 Version 2.11 - https://docs.aws.amazon.com/greengrass/v2/developerguide/disk-spooler-component.html

This disk spooler component , along with Nucleus configurations as specified in the above link will ensure that the MQTT messages are backedup to disk.

This will ensure that data loss is prevented in case of disconnection

AWS
답변함 10달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠