Hope
Hope

Reputation: 1292

Job Scheduling in Windows Azure in c#.net

I want to implement a job scheduler in my windows azure application.

My aim is to execute a specific application at each day at a particular time. For the that implementation I have some choice

1-Using Quartz.net

2-Windows scheduler

If there is any built in method available in C#.net for implement that. I hard about Windows Azure HPC Scheduler. Is it scheduler ?.

Upvotes: 4

Views: 4187

Answers (4)

ChristopheHvd
ChristopheHvd

Reputation: 273

In the case you use the ScheduledEnqueueTimeUtc property to delay the message enqueuing, I was wondering where the message is stocked before being sent to the queue? Because if you have 2 instances of your Web/Worker Role, what will happen?

  • you create the message and one of the instance stock it in a kind of cache? Or is it both the instance who cache it?

Two scenario : 1. - InstanceA stock the message in its cache, waiting to deliver it to the queue - InstanceA fail for any reason. - The message is lost forever.

    • Both instance stock it.
    • Instance A & B are enabled. The message is delivered twice in the queue.

In both case, it seems that the solution is not reliable..

Upvotes: 0

Sandrino Di Mattia
Sandrino Di Mattia

Reputation: 24895

The Job Scheduler functionality was recently added to Windows Azure allowing you to easily schedule jobs on specific intervals:

enter image description here

Here is a blog post explain how you can use these jobs to communicate with Web Sites, Web Roles and even Worker Roles: http://fabriccontroller.net/blog/posts/job-scheduling-in-windows-azure/

Upvotes: 6

Sandrino Di Mattia
Sandrino Di Mattia

Reputation: 24895

When you're doing scheduling in the Windows Azure there's something you need to keep in mind. You can have multiple instances of your Web/Worker Roles, meaning you have to take into account that your scheduled task could run multiple times, and that might not be something you want.

You might consider creating a scheduling system using Service Bus Queues. The BrokeredMessage class has an interesting property called ScheduledEnqueueTimeUtc, allowing you to schedule when a message should be enqueued (made available). This would allow fill the queue with messages that show up each hour for example.

http://msdn.microsoft.com/en-us/library/microsoft.servicebus.messaging.brokeredmessage.scheduledenqueuetimeutc.aspx

And if you decide to build such an implementation using Service Bus Queues you can decide to process messages at-most once (ReceiveAndDelete) or at least once (PeekLock).

Upvotes: 4

David Makogon
David Makogon

Reputation: 71030

While scheduling has been answered numerous times before (which is why I suggested this is a duplicate), I realized you asked a few specific things that haven't been addressed:

  • The HPC scheduler is for HPC workloads, and will not suit your purposes as a general task scheduler.
  • There's no specific task scheduler via c# = you'll need to write one or use a library such as quartz.
  • Remember that web and worker roles are basically Windows 2008 Server VM's. Whatever you can do in Windows Server, you can do nearly the same in Windows Azure VMs.

Please look at the other answer I referred to, as I provide an answer there that gives you details on creating a scheduler.

Upvotes: 2

Related Questions