DEV Community

Supraja Tangella
Supraja Tangella

Posted on

โฐ ๐—ง๐—ถ๐—บ๐—ฒ๐—ฟ ๐—ง๐—ฟ๐—ถ๐—ด๐—ด๐—ฒ๐—ฟ ๐— ๐—ฎ๐—ด๐—ถ๐—ฐ

โœจ Did you know you can run background jobs in Azure without any servers?

โœจ Thatโ€™s the power of a Timer Trigger in Azure Functions.

It helps you schedule code to run at fixed times.

You can clean up data, send reminders, or generate reports.

All with just a few lines of code.

C# example:

public static class TimerExample
{
[FunctionName("TimerExample")]
public static void Run(
[TimerTrigger("0 */5 * * * *")] TimerInfo myTimer,
ILogger log)
{
log.LogInformation($"Timer function executed at: {DateTime.Now}");
}
}

๐Ÿ• The above code runs every 5 minutes.

๐Ÿ• You can change the CRON expression for your schedule.

๐Ÿ’ก Simple. Fast. Reliable.

Where do you see timer triggers adding the most value in your projects?

Top comments (0)