In this blog we are going to see how to create a schedule-based job in Logic App. By the schedule-based job, we can run the flow immediately, later or any recurring interval. Once the flow is executed, we can call any function like database, API, blob etc. from the Logic App itself. In the real word scheduling-based job is very useful where we have to do same kind of task on a recurring interval like sending reports, clean up data from a storage on a specific interval or even calling an API on an interval time.
We have
seen many examples where we are calling different kind of connector from the
Logic App. So, we can easily integrate with Logic App. Here we are going to
create a very simple Scheduler-Based Logic App which will print the UTC time at
every one minute.
Create a Logic App:
We have
created many Logic App in previous blogs so create a similar one again. I am
using consumption-based logic app and given “schedulerdemo” name.
- In above step I have chosen “Recurrence” as trigger, this is the trigger which will create a scheduled based job.
- Now look closely in this component and see different option in the “Frequency” dropdown. So, if you click on “Add New Parameter” where you can choose the trigger time zone. Maybe you have to choose a time zone where your data resides. You will see all the country time zone and choose accordingly.
- Now observe another example of “Frequency”, once you select “Week” you will see all the days to choose from.
- If you choose “Day” in “Frequency” dropdown, you will see the no of days are listed so that you can choose which date you want this Logic App to run.
- You can
find many other options which you can select based on your requirement. You can
visit its website https://docs.microsoft.com/en-us/azure/logic-apps/concepts-schedule-automated-recurring-tasks-workflows and see what level of details you
can set as frequency in your Logic App.
- To keep it simple, I am going to use frequency every minute and adding a variable “calltime” to get UTC time as mentioned below
- I have added a dynamic expression “utcNow()” to get UTC time whenever which Logic App runs (every minute at the moment)
- I have waited for 3 minutes and can see in “Runs History” tab that Logic App has run 3 times at one-minute interval.
- You can select any run history link to see it more details. In below screenshot you can see it is running at 1 minute internal and printed UTC time.
No comments:
Post a Comment