Closed amit12cool closed 3 years ago
Hello Amit,
The file notification queue for an IoT Hub is shared resource over the whole hub. It will be shared by all clients. What happens if you have a single consumer for each hub. What happens with your notification then?
Thanks Anthony. I ran the sample code given in Azure docs with three consumers and one file uploader.The file upload notification arrived at one of the consumer one by one. So for 3 consumers the notification came consecutively and then on the fourth time it didn't came.The fifth time it came on the 1st consumer. So my 2 observations were below:-
1) File upload notification came on one of the consumer out of 3 consumers registered. Would you like to give any comments on this? 2) Every 4th notification was not received by any of the consumer.Can you run this use case?
Get Outlook for Androidhttps://aka.ms/ghei36
From: Anthony V. Ercolano notifications@github.com Sent: Friday, January 15, 2021 4:06:27 AM To: Azure/azure-iot-sdk-node azure-iot-sdk-node@noreply.github.com Cc: Amit Dhawan amit.dhawan@outlook.com; Author author@noreply.github.com Subject: Re: [Azure/azure-iot-sdk-node] [Technical Question] File upload notification receive on multiple listeners (#918)
Hello Amit,
The file notification queue for an IoT Hub is shared resource over the whole hub. It will be shared by all clients. What happens if you have a single consumer for each hub. What happens with your notification then?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Azure/azure-iot-sdk-node/issues/918#issuecomment-760520614, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABTB2JCJZL5PCEQF7Z22V43SZ5WWXANCNFSM4WA3WJSA.
Which version of the service client package (azure-iothub) are you using? Version 1.13.1 is the most current.
Also, what version of Node are you running? We are trying to reproduce the issue.
I'm using 1.13.1
Get Outlook for Androidhttps://aka.ms/ghei36
From: Anthony V. Ercolano notifications@github.com Sent: Saturday, January 16, 2021 3:46:56 AM To: Azure/azure-iot-sdk-node azure-iot-sdk-node@noreply.github.com Cc: Amit Dhawan amit.dhawan@outlook.com; Author author@noreply.github.com Subject: Re: [Azure/azure-iot-sdk-node] [Technical Question] File upload notification receive on multiple listeners (#918)
Which version of the service client package (azure-iothub) are you using? Version 1.13.1 is the most current.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Azure/azure-iot-sdk-node/issues/918#issuecomment-761226844, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABTB2JGVQTOIY7ENLYH4NPDS2C5FRANCNFSM4WA3WJSA.
The node version would be something like 10.12.1 or 12.16.0 or 14.5.0
Which sample/doc are you using?
Does your code use the complete on the message?
Are you just doing file uploads to a single hub and experiencing this problem?
1) File upload notification came on one of the consumer out of 3 consumers registered. Would you like to give any comments on this?
As @anthonyvercolano mentioned, the file notification queue for an IoT Hub is shared resource over the whole hub. This means that only one listener will receive the notification for a particular file upload.
2) Every 4th notification was not received by any of the consumer.Can you run this use case?
We tried to recreate your example code as best we can to reproduce the issue:
'use strict';
const Client = require('azure-iothub').Client;
const uuid = require('uuid');
async function registerFileUploadNotifiers() {
// get all iotHubs configured
const iotHubs = [
//put iothub connection strings here
];
await Promise.all(iotHubs.map(async (connectionString) => {
await listenToFileUploadEvent(connectionString).catch((error) => {
console.log(
`${error}: ${JSON.stringify(connectionString)}`,
);
});
}));
};
async function listenToFileUploadEvent(connectionString) {
const serviceClient = Client.fromConnectionString(connectionString);
await serviceClient.open();
const listenerId = uuid.v4();
const notificationReceiver = await serviceClient.getFileNotificationReceiver();
notificationReceiver.result.on('message', async (event) => {
console.log(`id: ${listenerId} file was uploaded: ${event.data.toString()}`);
});
}
async function main() {
await registerFileUploadNotifiers()
}
main().then(() => console.log("all good")).catch(() => console.log("something wrong"));
When running three instances of this program, we are seeing file upload notifications being received as expected with no missing notifications. Do you see anything different with our approach that could be preventing us from reproducing the issue? It is also possible that there is an extraneous 4th listener receiving notifications which can make it seem like every 4th notification is not being received.
Hi, @amit12cool. We will assume that your problem has been mitigated on Wednesday, February 3rd.
Closing this issue. @amit12cool, feel free to reopen if this is still a problem.
I'm trying to subscribe to n number of IoT hub file notification handlers using Azure IoT hub sdk for nodejs. And there are 2 consumers who are subscribing to same IoT hub file notification handlers. So each each IoT hub has 2 consumers subscribed to file upload notifications. Below is my code running on 2 consumers i.e. nodejs apps.
The issue I face is
notificationReceiver.result.on
event is never called even if the file was uploaded correctly to the IoT hub. Only once in a blue moon I get a notification. Am I missing something?