Handling changes to the configuration and topology of a hosted service
A Windows Azure hosted service has to detect and respond to changes to its service configuration. Two types of changes are exposed to the service: changes to the ConfigurationSettings
element of the service configuration file, ServiceConfiguration.cscfg
, and changes to service topology. The latter refers to changes in the number of instances of the various roles that comprise the service.
The RoleEnvironment
class exposes four events to which a role can register a callback method to be notified about these changes:
Changing
Changed
Stopping
StatusCheck
The Changing
event is raised before the change is applied to the role. For configuration setting changes, the RoleEnvironmentChangingEventArgs
parameter to the callback method identifies the existing value of any configuration setting being changed. For a service topology change, the argument specifies the names of any roles whose instance count is changing. The RoleEnvironmentChangingEventArgs...