Details
-
Task
-
Status: Closed (View Workflow)
-
P3
-
Resolution: Done
-
None
-
-
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
- Vert.x Core library: https://vertx.io/blog/eclipse-vert-x-4-milestone-1-released/#core-futurisation
- vertx-auth, vertx-web, vertx-mqtt, vertx-cassandra-client, vertx-redis-client, vertx-kakfa-client, vertx-amqp-client https://vertx.io/blog/eclipse-vert-x-4-milestone-2-released/#futurisation
- vertx-service-discovery, vertx-config, vertx-circuit-breaker https://vertx.io/blog/eclipse-vert-x-4-milestone-3-released/#futurisation
- Vert.x Shell, Vert.x Mail Client, Vert.x Consul Client, Vert.x RabbitMQ Client, Vert.x Stomp, Vert.x Mongo Client https://vertx.io/blog/eclipse-vert-x-4-milestone-4-released/#futurisation
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:
RMB-741"PostgresClient.withTransaction" should be complete before we start with this.RMB-758"SQLConnection.x(...) for each PostgresClient.x(AsyncResult<SQLConnection> tx, ...)" is a sub-task of this issue and should be worked on at the same time.- The existing method should call the new method and do .onComplete(promise) to avoid creating yet another promise, for details see https://github.com/folio-org/raml-module-builder/blob/master/doc/futurisation.md#future-as-return-value
TestRail: Results
Attachments
Issue Links
- blocks
-
RMB-609 Migrate RMB to Vert.x 4
-
- Closed
-
-
RMB-763 Migrate RMB to Vert.x 4 (development)
-
- Closed
-
-
UXPROD-2206 RMB vert.x 4 migration
-
- Open
-
- is cloned by
-
RMB-814 PostgresClient futurisation for Vert.x 4, Part 2
-
- Closed
-
- relates to
-
RMB-491 migrate deprecated/removed Future calls in preparation for vert.x4 migration
-
- Closed
-
-
RMB-601 PgUtil futurisation for Vert.x 4
-
- Closed
-
-
RMB-697 Explain Vert.x 4 futurisation
-
- Closed
-
-
RMB-758 SQLConnection.x(...) for each PostgresClient.x(AsyncResult<SQLConnection> tx, ...)
-
- Closed
-
-
RMB-783 ClientGenerator futurisation for Vert.x 4
-
- Closed
-
- mentioned in
-
Page Loading...