Good day,
I would like to ask a conceptual question that has been tearing my mind for a while. There is no right or wrong answer here, probably, but I hope to get better understanding of my options.
Situation: I have a Windows Azure Application. It consists of ONE Web Role with ONE instance and ONE worker role with TWO instances.
The main focus is on the worker role. It implements Quartz.NET scheduler to perform a task of getting information from a CRM system, making a table out of it and uploading to FTP server, say, every 8 hours. Very simple, nothing fancy.
The web role is used for manually triggering the job if someone needs it to run between 8 hour intervals. Simple user interface with pretty much one button.
However I would like to have a possibility to make it possible to change some configuration options of the worker role from the web role. For example credentials of destination FTP server and schedule of the job e.g. make it run hourly instead of 8 hours. The configuration DOES NOT need to persist if role goes offline. At the moment config is one in a static class.
This wouldn't seem a problem if I was running one worker role instance: I would send a message from web role via queue and change some static variables in the worker role, for example. But what confuses me is the message queues can be only picked up by one role instance, not both at the same time. So I will end up having the job run every 8 hours in one instance and every hour on another.
Is there any way to notify both instances that configuration needs to change?
There are several ways you could accomplish this. Let me offer two, aside from what @Gaurav suggested:
RoleEnvironment.Changing
event, and take action based on new settings.