Reakt to Guava Bridge

Reakt-Guava Website

Guava gets used by many libraries for its async support. Many NoSQL drivers use Guava, e.g., Cassandra.

Guava is JDK 1.6 backwards compatible.

Reakt provides composable promises that support lambda expressions, and a fluent API.

This bridge allows you to use Reakt's promises, reactive streams and callbacks to have a more modern Java experience with libs like Cassandra and other libs that use Guava.

Cassandra Reakt example

    futureToPromise(session.executeAsync(insertInto("Todo")
            .value("id", todo.getId())
            .value("createTime", todo.getCreateTime())
            .value("name", todo.getName())
            .value("description", todo.getDescription()))
    ).catchError(error -> {
        serviceMgmt.increment("add.todo.fail");
        serviceMgmt.increment("add.todo.fail." +
                error.getClass().getName().toLowerCase());
        recordCassandraError();
        promise.reject("unable to add todo", error);
    }).then(resultSet -> {
        if (resultSet.wasApplied()) {
            promise.resolve(true);
            serviceMgmt.increment("add.todo.success");
        } else {
            promise.resolve(false);
            serviceMgmt.increment("add.todo.fail.not.added");
        }
    }).invokeWithReactor(reactor, Duration.ofSeconds(10)))

Getting Started

maven

<dependency>
    <groupId>io.advantageous.reakt</groupId>
    <artifactId>reakt-guava</artifactId>
    <version>2.1.0.RELEASE</version>
</dependency>

gradle

compile 'io.advantageous.reakt:reakt-guava:2.1.0.RELEASE'

You can also use replay promises, all promises, any promises, and other features of Reakt to simplify async, reactive Java development.

Reakt gets used by QBit, and Conekt.

Related projects