Lessons learned using Apache Curator

A small ticket about 2 things that I learned after playing a few days with Apache Curator:

  • Curator listeners on recreated nodes will never be triggered. It sounds obvious (afterwards) but if you create listeners on zNodes that afterwards are deleted and then recreated, the listeners will not be triggered.
  • Do not use Curator listeners as ZooKeeper watchers. On ZooKeeper, changes to a zNode triggers the attached watches and then clear these watches. The good practice in the case of Curator listeners is to create them as early as possible and then to keep them alive as much as possible (of course do not forget to recreate them if the zNodes are recreated).