Skip to content

QBit Microservices Lib 1.5.0.RELEASE

Compare
Choose a tag to compare
@RichardHightower RichardHightower released this 22 Apr 09:18
· 101 commits to master since this release

QBit Microservices Lib now supports Reakt invokable promises for local and remote client proxies.
This gives a nice fluent API for async programming.

Invokeable promise

        employeeService.lookupEmployee("123")
               .then((employee)-> {...}).catchError(...).invoke();

QBit callbacks are now also Reakt Callbacks without breaking the QBit contract for Callbacks.

See Reakt Invokable Promises for more details.

A full write up on QBit Invokable Promise is pending, but the curious can see ReaktInterfacesTest Service Queue, ServiceBundle for more details, and the Remote Websocket Reakt interfaces for remote access proxies.

  • 683 Use Metrik for metrics system
  • 682 Support Reakt with Websocket RPC proxies
  • 680 Support Inovkable promises on Service Queues
  • 679 Testing for Inovkable promises on proxies
  • 678 Fix health check logging
  • 676 Remote proxies support Reakt Callbacks and promises
  • 675 Local proxies support Reakt Inokable promises
  • 674 Local proxies support Reakt callbacks
  • 673 Remote proxies support callback
  • 672 Get rid of boiler plate code for Reactor, StatsCollector and Health Check

Early on in this release, we added this.

The current release notes for the current build can be found under releases and there are 27 public releases in the maven repo.

Added support for Reakt in QBit 1

We added ability to convert to Reakt promises and Reakt Callbacks.

QBit 2 will use Reakt for reactor, callbacks and promises by default, but until then we need a way to start using promises on new projects as it is a simpler API than QBit CallbackBuilder (which will be gone in QBit 2).

Using Promise for success

import io.advantageous.qbit.reactive.Callback;
import io.advantageous.reakt.promise.Promise;
import static io.advantageous.qbit.reakt.Reakt.convertPromise;
import static io.advantageous.reakt.promise.Promise.promise;
...

        final AtomicReference<Employee> ref = new AtomicReference<>();
        final Promise<Employee> promise = promise();

        /* Set then callback in promise. */
        promise.then(ref::set);

        /* Convert promise to callback and then call the callback. */
        final Callback<Employee> employeeCallback = convertPromise(promise);
        employeeCallback.returnThis(new Employee("Rick"));

Using Promise for failure

        /** Set up success callback and failure callback. */
        promise.then(ref::set)
               .catchError(error::set);

        /** Convert promise to callback and then call the callback with error. */
        final Callback<Employee> employeeCallback = convertPromise(promise);
        employeeCallback.onError(new IllegalStateException());