Implementing Fire & Forget pattern with Nested Logic Apps

Oguzhan YIGIT
Published by Oguzhan YIGIT
Category : Azure / Logic Apps
28/12/2018

The Fire & Forget pattern

When you are dealing with an API (or an external process), you might want to start it and don’t want or need to wait untill the end of its execution. This is commonly called the Fire & Forget pattern.

 

Implementing the pattern with nested Logic Apps

Azure Logic Apps has a built-in connector to call a nested logic app. If the child logic app met the requirements, it can be called from a parent logic app with the “logic app connector”. The child logic have to be set with a http trigger and should reply with the Response action from the Request connector.
Below is the screenshot of the nested logic app with both http request trigger and the http response action.

fire and forget nested logic app

 

Note that the given response code is 202 which basically means “Accepted”. If a parent logic app call this one as a nested, it will fire the request and get the http accepted status code and both of the logic apps will continue to run. So the caller won’t wait untill the end of the nested one. The fire & forget pattern is easily implemented with Azure Logic Apps.

 

Ensure the resubmit feature still work

Now let see how resubmit feature behaves inside the nested logic app. If you do a resubmit action (through the api or through the portal) you will notice that the response action is skipped.

nested resubmit skipped

 

This is due to the resubmit feature. Because there is no caller, the action is ignored. By default, an action is executed if the previous one is successfully done. Because the “Response accepted” action is ignored,  following action is ignored. And this is happening untill the end of the flow. Except if it’s the behavior you want, you should ensure following action are executed even if the “Response accpeted” action is skipped. You can easily configure it by using the “configure run after” panel from the action shape by picking the “is skipped” option.

nested skip configure run after

 

If you resubmit any run of the nested logic app, you will now notice that the response action is skipped, but the following actions not.

resubmit nested correct behavior