Fork me on GitHub

Curator Async

Packaging

Curator Async is in its own package in Maven Central: curator-x-async

What Is Curator Async?

Curator Async is a DSL that wraps existing CuratorFramework instances. This DSL is entirely asynchronous and uses Java 8's CompletionStage mechanism for chaining, composing, etc. Additionally, Curator's original DSL has been cleaned up and simplified, in particular for operations such as create().

With this DSL you can do asynchronous tasks in a more natural, functional way using Java 8 lambdas.

The Curator Async package also contains a strongly typed DSL and strongly typed Cache Recipe wrappers that allows you to map a ZooKeeper path to a serializable class as opposed to raw byte arrays.

With this DSL you can do asynchronous tasks in a more natural, functional way using Java 8 lambdas. For example:

// let "client" be a CuratorFramework instance
AsyncCuratorFramework async = AsyncCuratorFramework.wrap(client);
async.checkExists().forPath(somePath).thenAccept(stat -> mySuccessOperation(stat));

See Curator Async for details.

This is a strongly typed DSL that allows you to map a Curator-style client to:

  • A ZooKeeper path (supporting parameterized substitutions)
  • A serializer for the data stored at the path
  • Options for how nodes should be created (sequential, compressed data, ttl, etc.)
  • ACLs for the nodes at the path
  • Options for how to delete nodes (guaranteed, deleting children, etc.)

For example:

ModeledFramework<Foo> modeled = ModeledFramework.wrap(client, fooModelSpec);
modeled.set(new Foo());

See Modeled Curator for details.

Curator Migrations allow you pre-apply transactions in a staged manner so that you can ensure a consistent state for parts of your ZooKeeper node hierarchy in a manner similar to database migration utilities.

See Migrations for details.