azureazure-logic-appsservicebus

trigger logic app from Azure Service bus in sequance


I am looking forward to your advice on the following - I have a requirement where the logic app would trigger from Azure Service bus in sequence (FIFO) and wait for the previous instance of the logic app to get complete (either successful or failed).

Az Service Bus topic: Enforce Message Ordering

Logic App: Concurrency Control On and Degree of Parallelism to 1.

However, I have noticed it doesn't give the desired results, every time. The issue is: the Logic app is not triggering in the proper sequence - FIFO. Can I get some suggestions on this please.. Thanks,


Solution

  • You can use When a message is received in a topic subscription (peek-lock) as the trigger. This trigger contains an option called Session Id --> Next Available which will get the Messages in FIFO using Session Id. This option is not available in Auto Complete, It is only present in peek-lock.

    enter image description here

    Then in Service Bus Enable below 2 options(Support Ordering while creating topic and Enabling sessions while creating subscription):

    While Creating Topic:

    enter image description here

    then while creating subscription inside topic:

    enter image description here

    And also use Concurrency and Parallelism to 1.

    Output:

    Sent 2 messages with session id's:

    enter image description here

    Then it triggers in Order:

    1st Message:

    enter image description here

    2nd Message:

    enter image description here