PostgresClient futurisation for Vert.x 4, Part 1

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:

Environment

None

Potential Workaround

None

Confluence content

mentioned on

Checklist

hide

TestRail: Results

Activity

Show:

Julian Ladisch March 15, 2021 at 11:50 AM

Progress status:

[x] closeClient
[x] save, saveAndReturnUpdatedEntity, upsert
[x] saveBatch, upsertBatch
[x] update
[x] delete
[ ] get
[ ] streamGet
[x] getById, getByIdForUpdate, getByIdAsString
[x] select, selectSingle
[ ] selectStream
[ ] execute
[x] getConnection
[ ] persistentlyCacheResult, removePersistentCacheResult
[x] runSQLFile

Done

Details

Assignee

Reporter

Priority

Story Points

Sprint

Development Team

Core: Platform

Fix versions

TestRail: Cases

Open TestRail: Cases

TestRail: Runs

Open TestRail: Runs

Created April 21, 2020 at 9:22 AM
Updated April 21, 2021 at 10:11 AM
Resolved March 15, 2021 at 12:52 PM
TestRail: Cases
TestRail: Runs

Flag notifications