Skip to content

publish_get_pending_job_executions raises MQTT exception #620

Closed
@ziyun

Description

@ziyun

Describe the bug

When trying to get the pending job executions VIA publish_get_pending_job_executions the returned future raises an exception.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

No exception should be thrown.

Current Behavior

This is the exception that gets thrown.

awscrt.exceptions.AwsCrtError: AWS_ERROR_MQTT_ACK_REASON_CODE_FAILURE: MQTT ack packet received with a failing reason code

The error code is 5165.

Reproduction Steps

from awsiot import iotjobs, mqtt5_client_builder
from awscrt import mqtt5


def on_lifecycle_stopped(lifecycle_stopped_data: mqtt5.LifecycleStoppedData):
    print("Client Stopped.")

def on_lifecycle_connection_success(lifecycle_connect_success_data: mqtt5.LifecycleConnectSuccessData):
    print("Lifecycle Connection Success")

def on_get_pending_job_executions_accepted(response):
    print("on_get_pending_job_executions_accepted")

endpoint = ""
port = 0
cert_path = ""
key_path = ""
ca_path = ""
thing_name = ""

mqtt5_client = mqtt5_client_builder.mtls_from_path(
        endpoint=endpoint,
        port=port,
        cert_filepath=cert_path,
        pri_key_filepath=key_path,
        ca_filepath=ca_path,
        client_id=thing_name,
        clean_session=False,
        keep_alive_secs=30,
        on_lifecycle_connection_success=on_lifecycle_connection_success,
        on_lifecycle_stopped=on_lifecycle_stopped)


mqtt5_client.start()
jobs_client = iotjobs.IotJobsClient(mqtt5_client)

try:
    # List the jobs queued and pending
    get_jobs_request = iotjobs.GetPendingJobExecutionsRequest(thing_name=thing_name)
    jobs_request_future_accepted, _ = jobs_client.subscribe_to_get_pending_job_executions_accepted(
        request=get_jobs_request,
        qos=mqtt5.QoS.AT_LEAST_ONCE,
        callback=on_get_pending_job_executions_accepted
    )
    # Wait for the subscription to succeed
    jobs_request_future_accepted.result()

    # Get a list of all the jobs
    get_jobs_request_future = jobs_client.publish_get_pending_job_executions(
        request=get_jobs_request,
        qos=mqtt5.QoS.AT_LEAST_ONCE
    )
    # Wait for the publish to succeed
    get_jobs_request_future.result()
except Exception as e:
    exit(e)

Possible Solution

No response

Additional Information/Context

No response

SDK version used

awsiotsdk==1.22.2

Environment details (OS name and version, etc.)

MacOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions