is there any way to change the status of the vm role instances from busy to ready. I would like to do this with wcf service if it is possible. Thanks a lot.
Asked
Active
Viewed 1,645 times
1 Answers
4
The Fabric Controller will check the status of your instance at regular intervals, and when doing so you'll be able to let it know if the instance is busy or not.
You'll simply need to handle the StatusCheck event and set it to busy (by calling the SetBusy method). Once you decide that the instance is ready (no longer busy), stop calling the SetBusy method.
public override bool OnStart()
{
RoleEnvironment.StatusCheck += RoleEnvironmentStatusCheck;
return base.OnStart();
}
// Use the busy object to indicate that the status of the role instance must be Busy
private volatile bool busy = true;
private void RoleEnvironmentStatusCheck(object sender, RoleInstanceStatusCheckEventArgs e)
{
If (this.busy)
{
// Sets the status of the role instance to Busy for a short interval.
// If you want the role instance to remain busy, add code to
// continue to call the SetBusy method
e.SetBusy();
}
}

Sandrino Di Mattia
- 24,739
- 2
- 60
- 65