AMQP disconnects sender links

Roelens Caleb 36 Reputation points

I'm making an application in Rust to connect to the Azure Iot Hub using AMQP.
I'm able to successfully connect and keep a connection.
But after a few minutes I get this exception:

Detaching sender link "/devices/temperature/messages/events" with error LinkDetached(Some(Error { condition: AmqpError(UnauthorizedAccess), description: Some("Token or Certificate is invalid."), info: Some({Symbol(B:""): Boolean(true), Symbol(B:""): String(B:"421ed3f4f4e14c429bf63047c95ef52d-G:0-TimeStamp:01/24/2022 18:38:42")}) }))

Do I need to refresh tokens or credentials, or do something more to keep the sender link up? Im using the Azure Root cert for the initial connection, and I use a self generated Sas-token that is valid for 7 days.

Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,113 questions
0 comments No comments
{count} votes

Accepted answer
  1. António Sérgio Azevedo 7,661 Reputation points Microsoft Employee

    Hello @Roelens Caleb as per documentation: Communicate with your IoT hub by using the AMQP Protocol | Additional notes

    Your client must occasionally be able to handle link redirections correctly. To understand such an operation, see your AMQP client documentation.

    Then in the code snippet :

    Once a redirect error is received, close the original client and recreate a new one to the re-directed address.

    Let me know if this helps you overcome the issue?


    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful