Googleアナリティクス

2018年6月18日月曜日

Respond to processing that requires long time with Logic Apps / Flow

Original Post is here.

I got a question from my friend "Logic Apps timeout 120 seconds, I want to avoid somehow", so it seemed interesting and tried it

As a specification, the action of Logic Apps comes with a timeout limit. Although there may be slight differences depending on the connector, basically it is 120 seconds exists as one restriction . Therefore, in processing that requires more time than that, asynchronous pattern , we tried that situation with Logic Apps alone.

image_thumb20

Create the main LogicFlow like this. As for the image, here is the process that calls it by HTTP is necessary for a long time.

image_thumb23

The called LogicFlow has this form. As the response action, set the retry-second in retry-after and the URL that you wish to call to check the location to check processing status.

image_thumb26

Finally, we create a LogicFlow and return the processing status in this way. As it was a trial, we look at the current time and if it is the right time we will return 200 as a result. Otherwise it becomes 202, and it returns the URL for situation confirmation again. Here we need to make it accessible by GET with an HTTP request trigger. The specification of Logic Apps is because GET is used to access the URL specified in the location.

image_thumb16

In the main LogicFlow, you can see that execution continued even after exceeding 120 seconds as described above.

image_thumb17

In the second LogicFlow, you will notice that there are no traces of calls left after being called from the big book for the first time.

image_thumb11

In the third LogicFlow that returns the situation, you can see that access is done at the interval specified by Retry-after like this.

By processing like this in this way, we can handle processing time exceeding 120 seconds. When actually using, LogicFlow starts processing that requires time after returning the response in 202 in the second LogicFlow, and records the processing status separately in the storage etc. In the third LogicFlow, I think that such a form is suitable, while checking the recorded situation, returning the result if processing is completed.

If you build it with a custom API, I think that LogicFlow can be created that handles processing that is required for a long time more easily.

0 件のコメント:

コメントを投稿