Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

IoT Hub's MQTT messages lost #279

Closed
dmandai opened this issue Sep 19, 2024 · 2 comments
Closed

IoT Hub's MQTT messages lost #279

dmandai opened this issue Sep 19, 2024 · 2 comments
Assignees

Comments

@dmandai
Copy link

dmandai commented Sep 19, 2024

Hello,

I am using this library in a project that needs the LARA-R6001 to be connected to the Microsoft IoT Hub (through MQTT).

When the LARA-R6001 excecutes the connection using the function:
int32_t uMqttClientConnect(uMqttClientContext_t *pContext, const uMqttClientConnection_t *pConnection);

But doesn't execute the Topic subscription.

The message Queue, if not empty, of the IoT Hub is cleared and no messages are available.
From the IoT Hub stand point the device has received all the messages.

We have already verified that this doesn't happen with other devices.
In fact, after the connection, the other device shows the messages received.

Any suggestion?

Thank you,
Davide.

@m-abubakar m-abubakar self-assigned this Sep 20, 2024
@m-abubakar
Copy link
Contributor

m-abubakar commented Sep 20, 2024

Hi @dmandai,

Sorry to hear that you are facing issues using the library. could you please share how you're using the uMqttClientConnect and uMqttClientSubscribe functions in your code?

You might find it helpful to refer to the MQTT example for comparison with your implementation.

Thank you.

@dmandai
Copy link
Author

dmandai commented Sep 20, 2024

Hi @m-abubakar,

Here the code used to execute the connection:

// Set MQTT connection options.
inst->connection->pBrokerNameStr = inst->url;
inst->connection->pClientIdStr = inst->client_id; // OPTIONAL
inst->connection->pUserNameStr = inst->user_name;
inst->connection->pPasswordStr = "";
inst->connection->keepAlive = true;
inst->connection->retain = false;
inst->connection->inactivityTimeoutSeconds = AZ_IOT_DEFAULT_MQTT_CONNECT_KEEPALIVE_SECONDS;
inst->connection->mqttSn = false; // DEFAULT
// Connect MQTT client to the Azure IoT Hub.
return uMqttClientConnect(inst->pContext, inst->connection);

Where the TLS SETTINGS are the following:

inst->tlsSettings->tlsVersionMin = U_SECURITY_TLS_VERSION_1_2;
inst->tlsSettings->pRootCaCertificateName = rootCertificateName;
inst->tlsSettings->pClientCertificateName = certificateName;
inst->tlsSettings->pClientPrivateKeyName = privateKeyName;
inst->tlsSettings->certificateCheck = U_SECURITY_TLS_CERTIFICATE_CHECK_ROOT_CA_URL;
inst->tlsSettings->pClientPrivateKeyPassword = NULL;
inst->tlsSettings->pExpectedServerUrl = iniCfg.mqttUrl;

Here the code used to execute the subscription:

ret = uMqttClientSubscribe(inst->pContext, topic, U_MQTT_QOS_AT_LEAST_ONCE); //U_MQTT_QOS_EXACTLY_ONCE);

Where:

Topic =  "devices/+/messages/devicebound/#"

Please note that some informations are missing because are application specific.

Thanks,
Davide.

@manemannen manemannen closed this as not planned Won't fix, can't repro, duplicate, stale Nov 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants