How to limit/configure the trigger execution in Azure Logic Apps
    • Dark
      Light
    • PDF

    How to limit/configure the trigger execution in Azure Logic Apps

    • Dark
      Light
    • PDF

    Article Summary

    One of the recent challenges that I noticed in Logic App users is to limit or impose some trigger condition with the intention of limiting the Azure Logic Apps trigger execution.

    The above challenge can be understood with a couple of better problem statements or real-world challenges.

    Use case scenario 1

    Consider, you have created an Azure Service Bus Queue without session enabled. The Azure Logic App workflow has been created with the When a message is received in a queue (peek-lock) trigger which fires at 15 seconds interval.

    When the logic app receives messages on the queue at a faster pace -more than 15 seconds, Azure Logic App trigger picks up multiple queue messages at a time, much faster than 1 message every 15 seconds.

    With this above scenario, the business use case needs to process the messages in sequence i.e. only one logic app instance to run at a time.

    Use case scenario 2

    Assume, you have designed a workflow with recurrence trigger that is scheduled to run every minute. The workflow typically completes within 30 seconds. Occasionally the workflow will take longer time to complete.

    If the workflow takes more than 1 minute to run, the next workflow will be started before the previous one finishes.

    The business use case is to stop the next workflow from starting if there is one currently running.

    Solution to the above challenges

    There is a simple solution for this challenge where you can go ahead and configure the degree of parallelism in Azure Logic App trigger settings. This can be achieved by following the below steps;

    1. Head to the logic apps designer
    2. Click the menu option in the trigger
      1.png
    3. In the window that pops up, select the Settings option
      2.png
      4.Under Settings, you can find the option called Concurrency Control in which enable the toggle button and configure the degree of parallelism.
      3.png

    By default, Logic App instances run at the same time, or in parallel. This control changes how new runs are queued and can't be changed after enabling. To run as many parallel instances as possible, leave this control turned off. To limit the number of parallel runs, turn on this control, and select a limit. To run sequentially, select 1 as the limit.

    Note

    Once you have configured the logic app concurrency control settings, then the process is irreversible. i.e. If you want to disable the option you have to discard the entire flow and reconfigure the entire orchestration with new logic app

    If you require singleton-like processing, you can configure Degree of Parallelism to be set to 1. If we want more parallelism, beyond the default value of 20, we can increase this value up to 50.

    Azure-functions.png


    Was this article helpful?