Press enter to see results or esc to cancel.

How to accelerate background tasks in cloud.

Reading Time: 2 minutes

Azure webjobs helps us quickly develop, deploy, and run background tasks in cloud. Close integration with utility components cuts down the development time to half.

Traditionally, batch jobs are developed using 3rd party libraries like Hangfire or Quartz. Their is a lot of boilerplate coding, and heavy configurations required to implement these APIs. Creating Jobs, Schedules, Triggers, Logging, and Handling failure manually is laborious. Also, maintaining these parameters becomes a nightmare as application grows and scales.

However Azure Webjobs shifts the configuration burden from developers to the framework. For example, a batch job function can process a message from a queue with minimal specification. New messages in queue will automatically trigger delegated functions. All we have do is specify which queue to listen for. Based on the frequency and configuration (very little) – webjobs will automatically pool for the queue messages.

5 benefits of using Azure webjobs in cloud.

  1. Easy Setup.
  2. Faster Development.
  3. Seamless Deployment.
  4. Built-in Logging.
  5. Extensible Components.

Easy setup:

Unlike custom batch jobs, we do not need to persist jobs and schedules in databases. The underlining webjobs framework  will automatically manage for us. Any changes to these schedules, are automatically updated.

Faster development:

Like any other function, you can start writing your batch processing logic without the overhead of implementing any IJob or ISchedules. Infact you can write this function in any of languages Azure currently supports and upload it.

Seamless Deployment:

There 2 major methods to deploy webjobs.

  1. Manual
    1. Zip up your code
    2. Upload it in the Azure app service.
    3. Select your schedules.
  2. Auto
    1. Add Azure webjob to your project.
    2. Reference webjob to main project.
    3. Select your schedules.

Manual deploy could be used incases of smaller code bases, and functions that have a single responsibility.

Auto deploy will publish the web job everytime the project is deployed.

Built-in Logging:

Azure portal actually logs all the run events of webjob functions automatically. These logs indicate important information like…

  1. Start, and end times when a webjob ran.
  2. Success or Failures status of a webjob.
  3. Context information like webjob id.
  4. Retrial attempts (incase of failures).
  5. Next due on (scheduled).
  6. Multi-threading.

Extensible for components:

Webjobs in combination with each of the below components lessens boilerplate code.

  1. Email: Use SendGrid attributes to define your to, from, subject to send out e-mails.
  2. Sms: Use Twillo components on top of functions to send out sms as output as result of trigger. Like on receiving a queue message or at a schedule.
  3. Queues: Trigger a function listening to a queue for messages by declaring the queue name on the function. Webjob will pool according to the frequency of the data. This pooling could be adjusted in case of over-utilization.
  4. Blob: Trigger a function on receiving a blob or as output as blob. Blobs are serialized files. We can create blob object in any type of content we want.
  5. File: Trigger a function on file attribute changes or file creations.
  6. Timer: Run a function every often or on a schedule.
  7. No Automatic: Create a manual trigger function. Useful with Web API integration or with webhooks.

Leave a Comment

Leave a Reply

Architect | Lead | Mentor | Blogger | Tech Enthus



I help in automation of business processes in Cloud. I'm a Lead Full Stack .Net Developer with over 12+ years of experience in developing web applications. My core expertise is in web applications designing, programming, implementing, automating, and monitoring.

Verified Services

View Full Profile →