You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@curator.apache.org by Evaristo José Camarero <ev...@yahoo.es> on 2013/09/26 15:10:25 UTC

PathChildrenCachebehaviour when reconnected


Hi there,

I am using PathChildrenCache recipe and  PathChildrenCacheListener to receive cache relevant events.

My doubt is when a PathChildrenCacheEvent.Type.CONNECTION_RECONNECTED is received. Can I assume that the initial cache sync with ZK has finished when this is received? If that is not the case, is there anyway to know when the initial sync has finished?

Thanks in advance,

Evaristo

Re: PathChildrenCachebehaviour when reconnected

Posted by Jordan Zimmerman <jo...@jordanzimmerman.com>.
OK - I understand now.

You are correct, if there has been a disconnect event, when you reconnect you have no guarantee for consistency. Consistency will occur eventually. Over the next few minutes after reconnection consistency will be achieved and corresponding ADD/UPDATE/REMOVE messages sent.

-JZ

On Sep 26, 2013, at 8:42 AM, Evaristo José Camarero <ev...@yahoo.es> wrote:

> Thanks for the fast answer.
> 
> Is the POST_INITIALIZED_EVENT triggered  on RECONNECTION? I thought it was only available during the FIRST CONNECTION
> 
> Let me repeat what I have understand to be sure it is right
> 
> After some period connected, when Curator framework  is DISCONNECTED (e.g. network issue), the cache will be non updated (e.g. some changes in the nodes). Once the ZK client RECONNECTS, the cache triggers the RECONNECTED event, BUT I do not have guarantee when the RECONNECTED event is received that cache has finished its sync with ZK. Is that OK? 
> 
> I assume that after RECONNECTION the cache will be updated and other events (child added, removed, changed) will be triggered. IS that OK?
> 
> Thanks in adavance,
> 
> Evaristo
> 
> De: Jordan Zimmerman <jo...@jordanzimmerman.com>
> Para: dev@curator.incubator.apache.org; Evaristo José Camarero <ev...@yahoo.es> 
> CC: "user@curator.incubator.apache.org" <us...@curator.incubator.apache.org> 
> Enviado: Jueves 26 de septiembre de 2013 16:54
> Asunto: Re: PathChildrenCachebehaviour when reconnected
> 
> > Can I assume that the initial cache sync with ZK has finished when this is received?
> No - this is just a duplicate of the normal Curator connection state event.
> 
> > is there anyway to know when the initial sync has finished?
> Start the cache with StartMode.POST_INITIALIZED_EVENT and wait for PathChildrenCacheEvent.Type.INITIALIZED
> 
> 
> 


Re: PathChildrenCachebehaviour when reconnected

Posted by Jordan Zimmerman <jo...@jordanzimmerman.com>.
OK - I understand now.

You are correct, if there has been a disconnect event, when you reconnect you have no guarantee for consistency. Consistency will occur eventually. Over the next few minutes after reconnection consistency will be achieved and corresponding ADD/UPDATE/REMOVE messages sent.

-JZ

On Sep 26, 2013, at 8:42 AM, Evaristo José Camarero <ev...@yahoo.es> wrote:

> Thanks for the fast answer.
> 
> Is the POST_INITIALIZED_EVENT triggered  on RECONNECTION? I thought it was only available during the FIRST CONNECTION
> 
> Let me repeat what I have understand to be sure it is right
> 
> After some period connected, when Curator framework  is DISCONNECTED (e.g. network issue), the cache will be non updated (e.g. some changes in the nodes). Once the ZK client RECONNECTS, the cache triggers the RECONNECTED event, BUT I do not have guarantee when the RECONNECTED event is received that cache has finished its sync with ZK. Is that OK? 
> 
> I assume that after RECONNECTION the cache will be updated and other events (child added, removed, changed) will be triggered. IS that OK?
> 
> Thanks in adavance,
> 
> Evaristo
> 
> De: Jordan Zimmerman <jo...@jordanzimmerman.com>
> Para: dev@curator.incubator.apache.org; Evaristo José Camarero <ev...@yahoo.es> 
> CC: "user@curator.incubator.apache.org" <us...@curator.incubator.apache.org> 
> Enviado: Jueves 26 de septiembre de 2013 16:54
> Asunto: Re: PathChildrenCachebehaviour when reconnected
> 
> > Can I assume that the initial cache sync with ZK has finished when this is received?
> No - this is just a duplicate of the normal Curator connection state event.
> 
> > is there anyway to know when the initial sync has finished?
> Start the cache with StartMode.POST_INITIALIZED_EVENT and wait for PathChildrenCacheEvent.Type.INITIALIZED
> 
> 
> 


Re: PathChildrenCachebehaviour when reconnected

Posted by Evaristo José Camarero <ev...@yahoo.es>.
Thanks for the fast answer.

Is the POST_INITIALIZED_EVENT triggered  on RECONNECTION? I thought it was only available during the FIRST CONNECTION

Let me repeat what I have understand to be sure it is right


After some period connected, when Curator framework  is DISCONNECTED (e.g. network issue), the cache will be non updated (e.g. some changes in the nodes). Once the ZK client RECONNECTS, the cache triggers the RECONNECTED event, BUT I do not have guarantee when the RECONNECTED event is received that cache has finished its sync with ZK. Is that OK? 


I assume that after RECONNECTION the cache will be updated and other events (child added, removed, changed) will be triggered. IS that OK?

Thanks in adavance,

Evaristo


________________________________
 De: Jordan Zimmerman <jo...@jordanzimmerman.com>
Para: dev@curator.incubator.apache.org; Evaristo José Camarero <ev...@yahoo.es> 
CC: "user@curator.incubator.apache.org" <us...@curator.incubator.apache.org> 
Enviado: Jueves 26 de septiembre de 2013 16:54
Asunto: Re: PathChildrenCachebehaviour when reconnected
 

> Can I assume that the initial cache sync with ZK has finished when this is received?
No - this is just a duplicate of the normal Curator connection state event.

> is there anyway to know when the initial sync has finished?
Start the cache with StartMode.POST_INITIALIZED_EVENT and wait for PathChildrenCacheEvent.Type.INITIALIZED

Re: PathChildrenCachebehaviour when reconnected

Posted by Evaristo José Camarero <ev...@yahoo.es>.
Thanks for the fast answer.

Is the POST_INITIALIZED_EVENT triggered  on RECONNECTION? I thought it was only available during the FIRST CONNECTION

Let me repeat what I have understand to be sure it is right


After some period connected, when Curator framework  is DISCONNECTED (e.g. network issue), the cache will be non updated (e.g. some changes in the nodes). Once the ZK client RECONNECTS, the cache triggers the RECONNECTED event, BUT I do not have guarantee when the RECONNECTED event is received that cache has finished its sync with ZK. Is that OK? 


I assume that after RECONNECTION the cache will be updated and other events (child added, removed, changed) will be triggered. IS that OK?

Thanks in adavance,

Evaristo


________________________________
 De: Jordan Zimmerman <jo...@jordanzimmerman.com>
Para: dev@curator.incubator.apache.org; Evaristo José Camarero <ev...@yahoo.es> 
CC: "user@curator.incubator.apache.org" <us...@curator.incubator.apache.org> 
Enviado: Jueves 26 de septiembre de 2013 16:54
Asunto: Re: PathChildrenCachebehaviour when reconnected
 

> Can I assume that the initial cache sync with ZK has finished when this is received?
No - this is just a duplicate of the normal Curator connection state event.

> is there anyway to know when the initial sync has finished?
Start the cache with StartMode.POST_INITIALIZED_EVENT and wait for PathChildrenCacheEvent.Type.INITIALIZED

Re: PathChildrenCachebehaviour when reconnected

Posted by Jordan Zimmerman <jo...@jordanzimmerman.com>.
> Can I assume that the initial cache sync with ZK has finished when this is received?
No - this is just a duplicate of the normal Curator connection state event.

> is there anyway to know when the initial sync has finished?
Start the cache with StartMode.POST_INITIALIZED_EVENT and wait for PathChildrenCacheEvent.Type.INITIALIZED



Re: PathChildrenCachebehaviour when reconnected

Posted by Jordan Zimmerman <jo...@jordanzimmerman.com>.
> Can I assume that the initial cache sync with ZK has finished when this is received?
No - this is just a duplicate of the normal Curator connection state event.

> is there anyway to know when the initial sync has finished?
Start the cache with StartMode.POST_INITIALIZED_EVENT and wait for PathChildrenCacheEvent.Type.INITIALIZED