Archived

This forum has been archived. Please start a new discussion on GitHub.

How to keep retrying when server is down?

Hello,

I'd like the client keep retrying to reconnect without stop, for example retry every 2 minutes.

Using Ice.RetryIntervals can only retry a limited times.

What can we do to implement this?

Thanks
sfxu

Comments

  • benoit
    benoit Rennes, France
    Hi,

    Yes, you can't specify an infinite number of retries with Ice.RetryIntervals. You'll have to implement the retry yourself, for example:
    while(true)
    {
         try
         {
              proxy->sayHello();
              break;
         }
         catch(const Ice::CommunicatorDestroyedException&)
         {
              throw;
         }
         catch(const Ice::LocalException&)
         {
              IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(2));
         }
    }
    

    Cheers,
    Benoit.