Partilhar via


RoleEnvironment.SimultaneousChanged Event

 

Occurs after a simultaneous change to the service configuration has been applied to the running instances of a role. A simultaneous change affects all role instances at the same time.

Namespace:   Microsoft.WindowsAzure.ServiceRuntime
Assembly:  Microsoft.WindowsAzure.ServiceRuntime (in Microsoft.WindowsAzure.ServiceRuntime.dll)

Syntax

public static event EventHandler<SimultaneousChangedEventArgs> SimultaneousChanged
public:
event EventHandler<SimultaneousChangedEventArgs^>^ SimultaneousChanged {
    static void add(EventHandler<SimultaneousChangedEventArgs^>^ value);
    static void remove(EventHandler<SimultaneousChangedEventArgs^>^ value);
}
static member SimultaneousChanged : IEvent<EventHandler<SimultaneousChangedEventArgs>,
    SimultaneousChangedEventArgs>
Public Shared Event SimultaneousChanged As EventHandler(Of SimultaneousChangedEventArgs)

Remarks

The SimultaneousChanged event and the SimultaneousChanging event are used together to identify and manage simultaneous configuration changes to the service model. The SimultaneousChangedEventArgs object provides the changes that were made in the service configuration. The changes are of the type SimultaneousTopologyChange.

The following code example shows how to use the SimultaneousChangedEventArgs object to write out the list of simultaneous topology changes that were made to the role:

public override bool OnStart()
{
   RoleEnvironment.SimultaneousChanged += RoleEnvironmentSimultaneousChanged;

   return base.OnStart();
}

private void RoleEnvironmentSimultaneousChanged(object sender, 
   SimultaneousChangedEventArgs e)
{
   // Get the list of topology changes
   var topologyChanges = 
      e.Changes.OfType<SimultaneousTopologyChange>();

   foreach (var change in topologyChanges) 
   {
      var message = "Topology change: " + change.RoleName;
      Trace.WriteLine(message, "Information");
   }
}

See Also

RoleEnvironment Class
Microsoft.WindowsAzure.ServiceRuntime Namespace

Return to top