Javascript Greengrass IPC subscribe to IoT Core - Error Subscribing to Topic.

0

While using the Javascript greengrass IPC client 'subscribeToIoTCore' I receive the following error in greengrass.log when the core device does not have an active internet connection.

2023-08-28T03:34:20.832Z [ERROR] (AwsEventLoop 2) com.aws.greengrass.mqttclient.AwsIotMqtt5Client: Error subscribing to topic. {clientId=Dev, topic=Iot/Dev-notifications-plugin/clientRequests}
java.util.concurrent.CompletionException: software.amazon.awssdk.crt.CrtRuntimeException: Mqtt5 operation failed due to a disconnection event in conjunction with the client's offline queue retention policy. AWS_ERROR_MQTT5_OPERATION_FAILED_DUE_TO_OFFLINE_QUEUE_POLICY(5156)
        at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:331)
        at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:346)
        at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:632)
        at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
        at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2088)
Caused by: software.amazon.awssdk.crt.CrtRuntimeException: Mqtt5 operation failed due to a disconnection event in conjunction with the client's offline queue retention policy. AWS_ERROR_MQTT5_OPERATION_FAILED_DUE_TO_OFFLINE_QUEUE_POLICY(5156)

my node js app throws this RpcError:

 type: 8,
  description: 'Eventstream RPC request failed.  Check serviceError property for details.',
  serviceError: {
    message: "Subscribe to topic Iot/Dev-notifications-plugin/clientRequests failed with error java.util.concurrent.CompletionException: software.amazon.awssdk.crt.CrtRuntimeException: Mqtt5 operation failed due to a disconnection event in conjunction with the client's offline queue retention policy. AWS_ERROR_MQTT5_OPERATION_FAILED_DUE_TO_OFFLINE_QUEUE_POLICY(5156)",
    _service: 'aws.greengrass#GreengrassCoreIPC',
    _message: "Subscribe to topic Iot/Dev-notifications-plugin/clientRequests failed with error java.util.concurrent.CompletionException: software.amazon.awssdk.crt.CrtRuntimeException: Mqtt5 operation failed due to a disconnection event in conjunction with the client's offline queue retention policy. AWS_ERROR_MQTT5_OPERATION_FAILED_DUE_TO_OFFLINE_QUEUE_POLICY(5156)",
    _errorCode: 'ServiceError'
  }
}

Our IoT devices are regularly not connected to the internet due to being deployed in remote location.

Should this be handled and retried by Greengrass or should this be handled by our node app? The other option I was looking at was subscribing to the local topic and using the Mqtt bridge component to bridge from IoT to the local pub/sub which might handle the internet connectivity issues?

What is the recommended method in my use case?

posta 9 mesi fa312 visualizzazioni
1 Risposta
0
Risposta accettata

subscribeToIoTCore won't be retried by Greengrass, your node app should handle retries. Bridge would work too, but it would add unnecessary complexity in this scenario.

AWS
con risposta 9 mesi fa
profile picture
ESPERTO
verificato un mese fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande