Logic App Builtin Async Handling
Description:
Follow this guide to create Wrapper Logic Apps to introduce Async communications for Azure Functions.
UPDATE 2021-05: I would skip this post and read about my Durable Functions post instead. I feel like this may work but it was back when I was first trying to solve a problem I have recently solved with Durable Functions so I would just do that instead. Keeping this here in case someone would rather do this.
To Resolve:
-
Create a Function App in python with a
time.sleep(6)
, call itsleep
- Using the template here, add a line before the return that sleeps the app for a few seconds.
-
Create a logic app called
Async
- Trigger = Http request
- Json structure = Paste in the same as the function app, in my case:
1 2 3 4 5 6 7 8
{ "name": "gerry", "car": "mustang", "birth": { "city": "fort worth", "state": "Texas" } }
- Action: Function App
- Request body:
$body
from trigger
- Request body:
- Action: Response
- Status Code = 200
- Headers: Content-Type - application/json
- Body:
$body
from functionsleep
- On the Response action, select the ellipses to go to Settings. Turn
Asynchronous Response
toggle to on.
-
Create a logic app called
Controller
- Trigger = Reoccurance to whenever you want
- Action: Logic App => Async
- The inputs will auto show up as
city
,state
,car
, andname
. Just fill them in with dummy data.
- The inputs will auto show up as
-
Run and you will get a response! It should take 6 seconds if you did
time.sleep(6)
in step 1. This proves that you can wrap a Logic App around a semi-long running Function App and take advantage of Async HTTP. I have not tested if this goes beyond the 3.9 minutes which will cause it to fail.1 2 3 4 5 6
[ { "response": "Hello, gerry.\n\nYou chose dodge.\n\nYour birth city is fort worth in the state of tx", "date_time": "2020-12-09-21-13-26" } ]
Comments