Search code examples
azureconnectionazure-worker-rolesazure-web-roles

is there anyway in azure to know instances for some other role have started or not?


in my service deployment i have two roles.. a web role and a worker role..
in my on_start() method of webrole im enumerating the instances of the worker roles and creating a tcp connection on some internal end point.
but very often it fails because the instances of the worker role havent started yet.
so the question is that can i know wether the instances have started or can i wait for instances of the worker role to start in some way? herez the code

public override bool OnStart()
        {
            // For information on handling configuration changes
            // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.

            ConnectionStatics.ConnectRouterToWorkers();
            Messaging.KeepReadingMessages.Start();

            return base.OnStart();
        }

Solution

  • Another option would be to have the worker roles put a message in a queue when they are started up. Then you could just check the queue and wait for it to post a message there.