I am receiving messages from Azure Service Bus using @azure/service-bus
using something like this (simplified)
let receivingMode = ReceiveMode.peekLock;
let sbClient = ServiceBusClient.createFromConnectionString(connectionString);
let subscriptionClient = this.sbClient.createSubscriptionClient(topicName, subscriptionName);
let receiver = this.subscriptionClient.createReceiver(receivingMode);
let messages = await this.receiver.receiveMessages(maxMessageCount, maxWaitTimeInSeconds);
It is possible that I'll get hundreds of messages per bulk and I saw that I can only complete() one by one, for example:
for (let index = 0; index < messages.length; index++) {
let message = messages[index];
await message.complete();
}
This seems that it will be a very slow process... is there a better approach?