Search code examples
azureservicebusazure-logic-app-standard

How to set maximum number of messages in the Standard Logic App built-in Service Bus trigger?


The Managed Service Bus connector used by the Standard Logic Apps has the Maximum Message Count parameter in the When one or more messages arrive in a queue (peek-lock) trigger.

enter image description here

The built-in Service Bus connector used by the Standard Logic Apps doesn't have this parameter in the When messages are available in a queue (peek-lock) trigger. With thousands of messages in the queue, it gets 1,000 messages in one go.

enter image description here

The Split On setting is switched off, and my problem is that the Logic App cannot process 1,000 messages within 5 minutes (the maximum message lock duration that can be set in the Service Bus queue).

Main question: Is there any way to limit the maximum number of messages that can be received by the built-in When messages are available in a queue (peek-lock) trigger in Standard Logic Apps? I didn't find anything helpful in the Reference for app settings - local.settings.json.

Bonus question: How else can we get and process thousands of Service Bus messages in a Standard Logic App using the built-in connector, if the message lock duration is set to the maximum allowed value (5 minutes), and the max delivery count is set to 3 - then the messages are moved the dead-letter queue.

Limitations:

  • Built-in connectors are preferred so that the traffic stays within the VNet.
  • Peek-lock is required so that messages are never lost until processed (e.g. if the workflow is cancelled).
  • Logic Apps is a preferred solution (opposed to e.g. Azure Functions).
  • Let's just agree/pretend that there's no way to improve the performance, and the processing of 1,000 messages will take longer than 5 minutes.

My only idea is switching to the Recurrence trigger and having a loop with the Get messages from a queue action there - it does have the Maximum Number Of Messages parameter. If this is your suggestion as well, no need to post it as an answer. :)

enter image description here

If possible, I want to stick to using the When messages are available in a queue (peek-lock) trigger.


Solution

  • In the past three months, Microsoft must have released an update to the built-in Service Bus connector that addresses this issue. The built-in connector's When messages are available in a queue (peek-lock) trigger now also has the maxMessageBatchSize parameter:

    New parameter in the trigger