19 February 2014
Recently, I have been working a lot with Apache ZooKeeper. Apache ZooKeeper provides a Java-based driver, but it does leave a little bit to be desired. In steps Apache Curator, which was originally created and open-sourced by Neflix and is now maintained by Apache. Apache Curator uses a fluent-style syntax to making using Apache ZooKeeper much easier. In particular, Apache Curator contains a more robust client class that handles things such as retry attempts, listeners and other utilities that would otherwise need to be manually wired up using the low-level Java-based driver. In order to support the use of Apache Curator within a Spring-based application, I decided to create a library that makes it easy to define Apache Curator clients in a Spring configuration for use in an application. One of the thinks to know about the Apache Curator client is that you only need one per instance/ensemble of Apache ZooKeeper. Therefore, using Spring to manage the injection of a Singleton bean into a class that needs access to the client is a perfect fit. The repository can be found on GitHub. Please check it out and let me know what you think. As always, contributions are welcome!
Currently, the spring-curator library only supports the definition, creation and injection of Apache Curator client instances. In the future, I would like to add the
following support to the spring-curator
library:
Support for registering custom retry policies
Definition of the following via the Spring configuration:
LeaderLatch
LeaderSelector
*Mutex locks
*Barrier barriers
SharedCount
DistributedAtomicLong
PathChildrenCache
NodeCache
PersistentEphemeralNode
*Queue queues