Showing posts with label WebJobs. Show all posts
Showing posts with label WebJobs. Show all posts

Monday, February 19, 2018

Microsoft Azure WebJobs


WebJobs in Microsoft Azure is considered to be a feature of Azure App Service. It lets you run a program or script in the same context as a web app, API app or mobile app. Azure WebJobs is a feature provided by the cloud computing platform of Microsoft which enables you to run programs/scripts as background processes by a part of Azure websites. You can upload and run an executable file such as as cmd, bat, exe (.NET), ps1, sh, php, py, js and jar. These programs run as WebJobs on a schedule (cron) or continuously.

Here are some typical scenarios that would be great for the Windows Azure WebJobs SDK:

ü  Image processing or other CPU-intensive work.
ü  Queue processing.
ü  RSS aggregation.
ü  File maintenance, such as aggregating or cleaning up log files.
ü  Other long-running tasks that you want to run in a background thread, such as sending emails.

WebJobs are invoked in two different ways, either they are triggered or they are continuously running. Triggered jobs happen on a schedule or when some event happens and Continuous jobs basically run a while loop.
WebJobs are deployed by copying them to the right place in the file-system (or using a designated API which will do the same). 

The following file types are accepted as runnable scripts that can be used as a job:

ü  .exe - .NET assemblies compiled with the WebJobs SDK
ü  .cmd, .bat, .exe (using windows cmd)
ü  .sh (using bash)
ü  .php (using php)
ü  .py (using python)
ü  .js (using node)

After you deploy your WebJobs from the portal, you can start and stop jobs, delete them, upload jobs as ZIP files, etc. You've got full control.

A good thing to point out, though, is that Azure WebJobs are more than just scheduled scripts, you can also create WebJobs as .NET projects written in C# or whatever.

WebJobs best work with Azure Queues, Blobs, Tables and Service Bus. WebJobs SDK has built in API to listen for the incoming data into these storage systems, hence the Job will be triggered when there is a new data and process it accordingly.