curator-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fabrizio Cucci <fabrizio.cu...@gmail.com>
Subject Re: Service Discovery and notifications
Date Mon, 23 Nov 2015 16:13:48 GMT
Thanks Jordan, I'll give it a try!

On 23 November 2015 at 01:25, Jordan Zimmerman <jordan@jordanzimmerman.com>
wrote:

> The cacheChanged() method of ServiceCacheListener is called each time a
> change in registrations is noticed. So, you can just respond to that.
>
> And, out of curiosity, what happens if the service B has been registered
> before the service A attaches his listener?
>
>
> Your listener will not get any notifications. However, the ServiceCache
> always has a view of the registered instances so you can iterate over it to
> get the info you want.
>
> -Jordan
>
> On Nov 20, 2015, at 2:58 PM, Fabrizio Cucci <fabrizio.cucci@gmail.com>
> wrote:
>
> Hello everyone,
>
> I'm currently working on a Java project that requires some service
> discovery and service coordination capabilities and I was thinking about
> using Curator for those purposes.
>
> One of the main feature I would need is to let one service be notified as
> soon as another service becomes available. E.g. the service A starts and at
> a certain point it requires some services B. Instead of repeatedly calling
> the getInstance method of the ServiceProvider abstraction at regular
> intervals until the service B becomes available (polling-like policy), it
> would be nice to get notified as soon as the services B becomes available
> (i.e. at least one instance has been registered).
>
> Is it something feasible using something like the ServiceCacheListener ?
> If yes, would it be the best way to go?
>
> And, out of curiosity, what happens if the service B has been registered
> before the service A attaches his listener? Does the service A get
> immediately notified because the service B is immediately available?
>
> Thanks in advance for your help and suggestions,
> Fabrizio
>
>
>

Mime
View raw message