Logic apps - Intermediate message event - wait for multiple message events

ShilpaGopal 100 Reputation points


I have below requirement.

I have 3 different Service bus queue messages for a specific request_id arriving at different times. (3 messages are sales number, order number, invoice number for a specific request_id/unique identifier/CustomerID)

I want the logic app to wait till all the 3 messages have arrived for a specific request_id and then only proceed to further steps. The further steps includes combining all the 3 different messages for a request_id and do some processing.

In BPMN nomenclature( or any BPMN tool), this can be achieved by "Intermediate Message event" where the workflow waits until multiple messages satisfying a particular condition is met (example: sales !=null && order !=null && invoice !=null). Once all the messages have arrived ie when the condition specified in the "Intermediate Message event" are met, then the workflow proceeds to the next step of processing.

My question - What is the equivalent design pattern for "Intermediate Message event" OR "wait till all messages arrive" in Logic apps?



Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,899 questions
0 comments No comments
{count} votes

Accepted answer
  1. MayankBargali-MSFT 69,581 Reputation points

    @ShilpaGopal Thanks for reaching out. Service bus is the pull model, and the client needs to pull the messages from service bus to consume the messages. Unfortunately, there is no out of box feature that can help with your use case that logic app will wait for the same message from all three different queues and then consume the message.

    You need to have your custom business logic to handle this scenario. The workaround that I could think of is to create three different queues with session enabled as I don't see any action that consumes the message using the message ID in logic app. The connector only supports consuming the message using session ID. You can now create the Request trigger in logic app that will trigger your logic app. Your individual application will now call the HTTP Post URL of the logic app once they send the message to any of the queue using session ID (set sessionID to your custom request_id) so the logic app is triggered. Now your workflow will try to consume the message using session ID from all three queues. If you didn't find one message from individual queue, then abandon the session so next time when your consumer application sends the message and calls the HTTP post URL of logic app then it can again validate. At the third call for the same session, you should be able to find all three messages and now you can consume those messages rather than abounding that message. Make sure you are setting the max delivery count more than 10 to take care of edge scenario.

    Feel free to get back to me if you need any assistance.

    Please accept as "Yes" if the answer is helpful so that it can help others in the community. If you need any help/clarification/concerns/follow up questions, then please click on "Add Comment" on my answer and provide more details.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful