Uploaded image for project: 'RAML Module Builder'
  1. RAML Module Builder
  2. RMB-602

PostgresClient futurisation for Vert.x 4, Part 1

    XMLWordPrintable

Details

    • CP: sprint 109
    • 8
    • Core: Platform

    Description

      This is part 1. Part 2 is RMB-814.

      Example:

      public interface NetClient {
      
        // Since 3.0
        void connect(int port, String host, Handler<AsyncResult<NetSocket>> handler);
      
        // New in 4.0
        Future<NetSocket> connect(int port, String host);
      }
      

      This hybrid model has already been implemented in

      The methods that return a future allow the more easy to use and more intuitive way for async coordination, example code from vertx-core doc:

      Future<HttpServer> httpServerFuture = Future.future(promise -> httpServer.listen(promise));
      
      Future<NetServer> netServerFuture = Future.future(promise -> netServer.listen(promise));
      
      CompositeFuture.all(httpServerFuture, netServerFuture).onComplete(ar -> {
        if (ar.succeeded()) {
          // All servers started
        } else {
          // At least one server failed
        }
      });
      

      Task:
      For each PostgresClient method that takes a Handler<AsyncResult<T>> parameter create a function without such parameter that returns a Future<T>.

      This can easily been split into several sub-tasks because there are many independent methods. This allows for smaller pull requests and early code review feedback.

      For details see
      https://github.com/folio-org/raml-module-builder/blob/master/doc/futurisation.md

      Implementation notes:

      TestRail: Results

        Attachments

          Issue Links

            Activity

              People

                julianladisch Julian Ladisch
                julianladisch Julian Ladisch
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  TestRail: Runs

                    TestRail: Cases