From a7b091d80250b2e213c734240769a1d2aca0ef56 Mon Sep 17 00:00:00 2001 From: Clement Escoffier Date: Mon, 13 Jul 2020 13:16:39 +0200 Subject: [PATCH] Update quickstarts to avoid using the deprecated APIS from Mutiny 0.6.0 The deprecated methods are still available, but are going to be removed in ~ 6 months. Depends on https://github.com/quarkusio/quarkus/pull/10676 --- .../org/acme/dynamodb/FruitAsyncService.java | 4 ++-- .../org/acme/kms/QuarkusKmsAsyncResource.java | 12 ++++++----- .../org/acme/s3/S3AsyncClientResource.java | 2 +- .../org/acme/ses/QuarkusSesAsyncResource.java | 2 +- .../acme/sns/QuarksCannonAsyncResource.java | 4 ++-- .../acme/sns/QuarksShieldAsyncResource.java | 18 ++++++++++------- .../acme/sqs/QuarksCannonAsyncResource.java | 4 ++-- .../acme/sqs/QuarksShieldAsyncResource.java | 4 ++-- .../java/org/acme/reactive/crud/Fruit.java | 14 ++++++------- .../org/acme/reactive/crud/FruitResource.java | 16 +++++++-------- .../started/ReactiveGreetingService.java | 4 ++-- .../examples/hello/HelloWorldEndpoint.java | 2 +- .../examples/hello/HelloWorldTlsEndpoint.java | 2 +- .../java/org/acme/vertx/EventResource.java | 2 +- .../src/main/java/org/acme/vertx/Fruit.java | 12 +++++------ .../java/org/acme/vertx/FruitResource.java | 20 +++++++++---------- 16 files changed, 64 insertions(+), 58 deletions(-) diff --git a/amazon-dynamodb-quickstart/src/main/java/org/acme/dynamodb/FruitAsyncService.java b/amazon-dynamodb-quickstart/src/main/java/org/acme/dynamodb/FruitAsyncService.java index e18bbadb25..bd90552b10 100644 --- a/amazon-dynamodb-quickstart/src/main/java/org/acme/dynamodb/FruitAsyncService.java +++ b/amazon-dynamodb-quickstart/src/main/java/org/acme/dynamodb/FruitAsyncService.java @@ -17,7 +17,7 @@ public class FruitAsyncService extends AbstractService { public Uni> findAll() { return Uni.createFrom().completionStage(() -> dynamoDB.scan(scanRequest())) - .onItem().apply(res -> res.items().stream().map(Fruit::from).collect(Collectors.toList())); + .onItem().transform(res -> res.items().stream().map(Fruit::from).collect(Collectors.toList())); } public Uni> add(Fruit fruit) { @@ -27,6 +27,6 @@ public Uni> add(Fruit fruit) { public Uni get(String name) { return Uni.createFrom().completionStage(() -> dynamoDB.getItem(getRequest(name))) - .onItem().apply(resp -> Fruit.from(resp.item())); + .onItem().transform(resp -> Fruit.from(resp.item())); } } diff --git a/amazon-kms-quickstart/src/main/java/org/acme/kms/QuarkusKmsAsyncResource.java b/amazon-kms-quickstart/src/main/java/org/acme/kms/QuarkusKmsAsyncResource.java index 083e063701..6ea0e8d29c 100644 --- a/amazon-kms-quickstart/src/main/java/org/acme/kms/QuarkusKmsAsyncResource.java +++ b/amazon-kms-quickstart/src/main/java/org/acme/kms/QuarkusKmsAsyncResource.java @@ -29,16 +29,18 @@ public class QuarkusKmsAsyncResource { @Path("/encrypt") public Uni encrypt(String data) { return Uni.createFrom().completionStage(kms.encrypt(req -> req.keyId(keyArn).plaintext(SdkBytes.fromUtf8String(data)))) - .onItem().apply(EncryptResponse::ciphertextBlob) - .onItem().apply(blob -> Base64.encodeBase64String(blob.asByteArray())); + .onItem().transform(EncryptResponse::ciphertextBlob) + .onItem().transform(blob -> Base64.encodeBase64String(blob.asByteArray())); } @POST @Path("/decrypt") public Uni decrypt(String data) { return Uni.createFrom().item(SdkBytes.fromByteArray(Base64.decodeBase64(data.getBytes()))) - .onItem().produceCompletionStage(msg -> kms.decrypt(req -> req.keyId(keyArn).ciphertextBlob(msg))) - .onItem().apply(DecryptResponse::plaintext) - .onItem().apply(SdkBytes::asUtf8String); + .onItem().transformToUni(msg -> + Uni.createFrom().completionStage(kms.decrypt(req -> req.keyId(keyArn).ciphertextBlob(msg))) + ) + .onItem().transform(DecryptResponse::plaintext) + .onItem().transform(SdkBytes::asUtf8String); } } \ No newline at end of file diff --git a/amazon-s3-quickstart/src/main/java/org/acme/s3/S3AsyncClientResource.java b/amazon-s3-quickstart/src/main/java/org/acme/s3/S3AsyncClientResource.java index 448bb618ae..bb45f16fcd 100644 --- a/amazon-s3-quickstart/src/main/java/org/acme/s3/S3AsyncClientResource.java +++ b/amazon-s3-quickstart/src/main/java/org/acme/s3/S3AsyncClientResource.java @@ -77,7 +77,7 @@ public Uni> listFiles() { .build(); return Uni.createFrom().completionStage(() -> s3.listObjects(listRequest)) - .onItem().apply(result -> toFileItems(result)); + .onItem().transform(result -> toFileItems(result)); } private List toFileItems(ListObjectsResponse objects) { diff --git a/amazon-ses-quickstart/src/main/java/org/acme/ses/QuarkusSesAsyncResource.java b/amazon-ses-quickstart/src/main/java/org/acme/ses/QuarkusSesAsyncResource.java index b982b66c34..56872bfd17 100644 --- a/amazon-ses-quickstart/src/main/java/org/acme/ses/QuarkusSesAsyncResource.java +++ b/amazon-ses-quickstart/src/main/java/org/acme/ses/QuarkusSesAsyncResource.java @@ -30,6 +30,6 @@ public Uni encrypt(Email data) { .message(msg -> msg .subject(sub -> sub.data(data.getSubject())) .body(b -> b.text(txt -> txt.data(data.getBody())))))) - .onItem().apply(SendEmailResponse::messageId); + .onItem().transform(SendEmailResponse::messageId); } } \ No newline at end of file diff --git a/amazon-sns-quickstart/src/main/java/org/acme/sns/QuarksCannonAsyncResource.java b/amazon-sns-quickstart/src/main/java/org/acme/sns/QuarksCannonAsyncResource.java index e70b9de69a..795518ee73 100644 --- a/amazon-sns-quickstart/src/main/java/org/acme/sns/QuarksCannonAsyncResource.java +++ b/amazon-sns-quickstart/src/main/java/org/acme/sns/QuarksCannonAsyncResource.java @@ -39,7 +39,7 @@ public Uni publish(Quark quark) throws Exception { return Uni.createFrom() .completionStage(sns.publish(p -> p.topicArn(topicArn).message(message))) .onItem().invoke(item -> LOGGER.infov("Fired Quark[{0}, {1}}]", quark.getFlavor(), quark.getSpin())) - .onItem().apply(PublishResponse::messageId) - .onItem().apply(id -> Response.ok().entity(id).build()); + .onItem().transform(PublishResponse::messageId) + .onItem().transform(id -> Response.ok().entity(id).build()); } } \ No newline at end of file diff --git a/amazon-sns-quickstart/src/main/java/org/acme/sns/QuarksShieldAsyncResource.java b/amazon-sns-quickstart/src/main/java/org/acme/sns/QuarksShieldAsyncResource.java index c622013f6f..759c757a32 100644 --- a/amazon-sns-quickstart/src/main/java/org/acme/sns/QuarksShieldAsyncResource.java +++ b/amazon-sns-quickstart/src/main/java/org/acme/sns/QuarksShieldAsyncResource.java @@ -58,14 +58,18 @@ public Uni notificationEndpoint(@HeaderParam("x-amz-sns-message-type") if (messageType.equals(NOTIFICATION_TYPE)) { return Uni.createFrom().item(readObject(SnsNotification.class, message)) - .onItem().apply(notification -> readObject(Quark.class, notification.getMessage())) + .onItem().transform(notification -> readObject(Quark.class, notification.getMessage())) .onItem().invoke(quark -> LOGGER.infov("Quark[{0}, {1}] collision with the shield.", quark.getFlavor(), quark.getSpin())) - .onItem().apply(quark -> Response.ok().build()); + .onItem().transform(quark -> Response.ok().build()); } else if (messageType.equals(SUBSCRIPTION_CONFIRMATION_TYPE)) { return Uni.createFrom().item(readObject(SnsSubscriptionConfirmation.class, message)) - .onItem().produceCompletionStage(msg -> sns.confirmSubscription(confirm -> confirm.topicArn(topicArn).token(msg.getToken()))) + .onItem().transformToUni(msg -> + Uni.createFrom().completionStage( + sns.confirmSubscription(confirm -> confirm.topicArn(topicArn).token(msg.getToken())) + ) + ) .onItem().invoke(resp -> LOGGER.info("Subscription confirmed. Ready for quarks collisions.")) - .onItem().apply(resp -> Response.ok().build()); + .onItem().transform(resp -> Response.ok().build()); } else if (messageType.equals(UNSUBSCRIPTION_CONFIRMATION_TYPE)) { LOGGER.info("We are unsubscribed"); return Uni.createFrom().item(Response.ok().build()); @@ -79,10 +83,10 @@ public Uni notificationEndpoint(@HeaderParam("x-amz-sns-message-type") public Uni subscribe() { return Uni.createFrom() .completionStage(sns.subscribe(s -> s.topicArn(topicArn).protocol("http").endpoint(notificationEndpoint()))) - .onItem().apply(SubscribeResponse::subscriptionArn) + .onItem().transform(SubscribeResponse::subscriptionArn) .onItem().invoke(this::setSubscriptionArn) .onItem().invoke(arn -> LOGGER.infov("Subscribed Quarks shield with id = {0} ", arn)) - .onItem().apply(arn -> Response.ok().entity(arn).build()); + .onItem().transform(arn -> Response.ok().entity(arn).build()); } @POST @@ -93,7 +97,7 @@ public Uni unsubscribe() { .completionStage(sns.unsubscribe(s -> s.subscriptionArn(subscriptionArn))) .onItem().invoke(arn -> LOGGER.infov("Unsubscribed quarks shield for id = {0}", subscriptionArn)) .onItem().invoke(arn -> subscriptionArn = null) - .onItem().apply(arn -> Response.ok().build()); + .onItem().transform(arn -> Response.ok().build()); } else { return Uni.createFrom().item(Response.status(400).entity("Not subscribed yet").build()); } diff --git a/amazon-sqs-quickstart/src/main/java/org/acme/sqs/QuarksCannonAsyncResource.java b/amazon-sqs-quickstart/src/main/java/org/acme/sqs/QuarksCannonAsyncResource.java index 6f59a87d89..9740feb2fb 100644 --- a/amazon-sqs-quickstart/src/main/java/org/acme/sqs/QuarksCannonAsyncResource.java +++ b/amazon-sqs-quickstart/src/main/java/org/acme/sqs/QuarksCannonAsyncResource.java @@ -39,7 +39,7 @@ public Uni sendMessage(Quark quark) throws Exception { return Uni.createFrom() .completionStage(sqs.sendMessage(m -> m.queueUrl(queueUrl).messageBody(message))) .onItem().invoke(item -> LOGGER.infov("Fired Quark[{0}, {1}}]", quark.getFlavor(), quark.getSpin())) - .onItem().apply(SendMessageResponse::messageId) - .onItem().apply(id -> Response.ok().entity(id).build()); + .onItem().transform(SendMessageResponse::messageId) + .onItem().transform(id -> Response.ok().entity(id).build()); } } \ No newline at end of file diff --git a/amazon-sqs-quickstart/src/main/java/org/acme/sqs/QuarksShieldAsyncResource.java b/amazon-sqs-quickstart/src/main/java/org/acme/sqs/QuarksShieldAsyncResource.java index e63b925018..8dc6687199 100644 --- a/amazon-sqs-quickstart/src/main/java/org/acme/sqs/QuarksShieldAsyncResource.java +++ b/amazon-sqs-quickstart/src/main/java/org/acme/sqs/QuarksShieldAsyncResource.java @@ -37,8 +37,8 @@ public class QuarksShieldAsyncResource { public Uni> receive() { return Uni.createFrom() .completionStage(sqs.receiveMessage(m -> m.maxNumberOfMessages(10).queueUrl(queueUrl))) - .onItem().apply(ReceiveMessageResponse::messages) - .onItem().apply(m -> m.stream().map(Message::body).map(this::toQuark).collect(Collectors.toList())); + .onItem().transform(ReceiveMessageResponse::messages) + .onItem().transform(m -> m.stream().map(Message::body).map(this::toQuark).collect(Collectors.toList())); } private Quark toQuark(String message) { diff --git a/getting-started-reactive-crud/src/main/java/org/acme/reactive/crud/Fruit.java b/getting-started-reactive-crud/src/main/java/org/acme/reactive/crud/Fruit.java index dd751c5fdd..a69f0cb5d7 100644 --- a/getting-started-reactive-crud/src/main/java/org/acme/reactive/crud/Fruit.java +++ b/getting-started-reactive-crud/src/main/java/org/acme/reactive/crud/Fruit.java @@ -46,29 +46,29 @@ public Fruit(Long id, String name) { public static Multi findAll(PgPool client) { return client.query("SELECT id, name FROM fruits ORDER BY name ASC").execute() - .onItem().produceMulti(set -> Multi.createFrom().iterable(set)) - .onItem().apply(Fruit::from); + .onItem().transformToMulti(set -> Multi.createFrom().iterable(set)) + .onItem().transform(Fruit::from); } public static Uni findById(PgPool client, Long id) { return client.preparedQuery("SELECT id, name FROM fruits WHERE id = $1").execute(Tuple.of(id)) - .onItem().apply(RowSet::iterator) - .onItem().apply(iterator -> iterator.hasNext() ? from(iterator.next()) : null); + .onItem().transform(RowSet::iterator) + .onItem().transform(iterator -> iterator.hasNext() ? from(iterator.next()) : null); } public Uni save(PgPool client) { return client.preparedQuery("INSERT INTO fruits (name) VALUES ($1) RETURNING (id)").execute(Tuple.of(name)) - .onItem().apply(pgRowSet -> pgRowSet.iterator().next().getLong("id")); + .onItem().transform(pgRowSet -> pgRowSet.iterator().next().getLong("id")); } public Uni update(PgPool client) { return client.preparedQuery("UPDATE fruits SET name = $1 WHERE id = $2").execute(Tuple.of(name, id)) - .onItem().apply(pgRowSet -> pgRowSet.rowCount() == 1); + .onItem().transform(pgRowSet -> pgRowSet.rowCount() == 1); } public static Uni delete(PgPool client, Long id) { return client.preparedQuery("DELETE FROM fruits WHERE id = $1").execute(Tuple.of(id)) - .onItem().apply(pgRowSet -> pgRowSet.rowCount() == 1); + .onItem().transform(pgRowSet -> pgRowSet.rowCount() == 1); } private static Fruit from(Row row) { diff --git a/getting-started-reactive-crud/src/main/java/org/acme/reactive/crud/FruitResource.java b/getting-started-reactive-crud/src/main/java/org/acme/reactive/crud/FruitResource.java index e89e553673..cc4786df38 100644 --- a/getting-started-reactive-crud/src/main/java/org/acme/reactive/crud/FruitResource.java +++ b/getting-started-reactive-crud/src/main/java/org/acme/reactive/crud/FruitResource.java @@ -77,30 +77,30 @@ public Multi get() { @Path("{id}") public Uni getSingle(@PathParam Long id) { return Fruit.findById(client, id) - .onItem().apply(fruit -> fruit != null ? Response.ok(fruit) : Response.status(Status.NOT_FOUND)) - .onItem().apply(ResponseBuilder::build); + .onItem().transform(fruit -> fruit != null ? Response.ok(fruit) : Response.status(Status.NOT_FOUND)) + .onItem().transform(ResponseBuilder::build); } @POST public Uni create(Fruit fruit) { return fruit.save(client) - .onItem().apply(id -> URI.create("/fruits/" + id)) - .onItem().apply(uri -> Response.created(uri).build()); + .onItem().transform(id -> URI.create("/fruits/" + id)) + .onItem().transform(uri -> Response.created(uri).build()); } @PUT @Path("{id}") public Uni update(@PathParam Long id, Fruit fruit) { return fruit.update(client) - .onItem().apply(updated -> updated ? Status.OK : Status.NOT_FOUND) - .onItem().apply(status -> Response.status(status).build()); + .onItem().transform(updated -> updated ? Status.OK : Status.NOT_FOUND) + .onItem().transform(status -> Response.status(status).build()); } @DELETE @Path("{id}") public Uni delete(@PathParam Long id) { return Fruit.delete(client, id) - .onItem().apply(deleted -> deleted ? Status.NO_CONTENT : Status.NOT_FOUND) - .onItem().apply(status -> Response.status(status).build()); + .onItem().transform(deleted -> deleted ? Status.NO_CONTENT : Status.NOT_FOUND) + .onItem().transform(status -> Response.status(status).build()); } } diff --git a/getting-started-reactive/src/main/java/org/acme/getting/started/ReactiveGreetingService.java b/getting-started-reactive/src/main/java/org/acme/getting/started/ReactiveGreetingService.java index 7b3513d993..7aacc831d5 100644 --- a/getting-started-reactive/src/main/java/org/acme/getting/started/ReactiveGreetingService.java +++ b/getting-started-reactive/src/main/java/org/acme/getting/started/ReactiveGreetingService.java @@ -12,12 +12,12 @@ public class ReactiveGreetingService { public Uni greeting(String name) { return Uni.createFrom().item(name) - .onItem().apply(n -> String.format("hello %s", name)); + .onItem().transform(n -> String.format("hello %s", name)); } public Multi greetings(int count, String name) { return Multi.createFrom().ticks().every(Duration.ofSeconds(1)) - .onItem().apply(n -> String.format("hello %s - %d", name, n)) + .onItem().transform(n -> String.format("hello %s - %d", name, n)) .transform().byTakingFirstItems(count); } diff --git a/grpc-plain-text-quickstart/src/main/java/io/quarkus/grpc/examples/hello/HelloWorldEndpoint.java b/grpc-plain-text-quickstart/src/main/java/io/quarkus/grpc/examples/hello/HelloWorldEndpoint.java index 96c481a3c3..9028734a31 100644 --- a/grpc-plain-text-quickstart/src/main/java/io/quarkus/grpc/examples/hello/HelloWorldEndpoint.java +++ b/grpc-plain-text-quickstart/src/main/java/io/quarkus/grpc/examples/hello/HelloWorldEndpoint.java @@ -34,7 +34,7 @@ public String helloBlocking(@PathParam("name") String name) { @Path("/mutiny/{name}") public Uni helloMutiny(@PathParam("name") String name) { return mutinyHelloService.sayHello(HelloRequest.newBuilder().setName(name).build()) - .onItem().apply((reply) -> generateResponse(reply)); + .onItem().transform((reply) -> generateResponse(reply)); } public String generateResponse(HelloReply reply) { diff --git a/grpc-tls-quickstart/src/main/java/io/quarkus/grpc/examples/hello/HelloWorldTlsEndpoint.java b/grpc-tls-quickstart/src/main/java/io/quarkus/grpc/examples/hello/HelloWorldTlsEndpoint.java index fa598a1910..6d989088e3 100644 --- a/grpc-tls-quickstart/src/main/java/io/quarkus/grpc/examples/hello/HelloWorldTlsEndpoint.java +++ b/grpc-tls-quickstart/src/main/java/io/quarkus/grpc/examples/hello/HelloWorldTlsEndpoint.java @@ -32,6 +32,6 @@ public String helloBlocking(@PathParam("name") String name) { @Path("/mutiny/{name}") public Uni helloMutiny(@PathParam("name") String name) { return mutinyHelloService.sayHello(HelloRequest.newBuilder().setName(name).build()) - .onItem().apply(HelloReply::getMessage); + .onItem().transform(HelloReply::getMessage); } } diff --git a/vertx-quickstart/src/main/java/org/acme/vertx/EventResource.java b/vertx-quickstart/src/main/java/org/acme/vertx/EventResource.java index 0e8cea91fc..fecdd553c2 100644 --- a/vertx-quickstart/src/main/java/org/acme/vertx/EventResource.java +++ b/vertx-quickstart/src/main/java/org/acme/vertx/EventResource.java @@ -23,6 +23,6 @@ public class EventResource { @Path("{name}") public Uni greeting(@PathParam String name) { return bus. request("greeting", name) - .onItem().apply(Message::body); + .onItem().transform(Message::body); } } diff --git a/vertx-quickstart/src/main/java/org/acme/vertx/Fruit.java b/vertx-quickstart/src/main/java/org/acme/vertx/Fruit.java index 574deea9e7..9bf74c70ef 100644 --- a/vertx-quickstart/src/main/java/org/acme/vertx/Fruit.java +++ b/vertx-quickstart/src/main/java/org/acme/vertx/Fruit.java @@ -46,7 +46,7 @@ public Fruit(Long id, String name) { public static Uni> findAll(PgPool client) { return client.query("SELECT id, name FROM fruits ORDER BY name ASC").execute() - .onItem().apply(pgRowSet -> { + .onItem().transform(pgRowSet -> { List list = new ArrayList<>(pgRowSet.size()); for (Row row : pgRowSet) { list.add(from(row)); @@ -57,23 +57,23 @@ public static Uni> findAll(PgPool client) { public static Uni findById(PgPool client, Long id) { return client.preparedQuery("SELECT id, name FROM fruits WHERE id = $1").execute(Tuple.of(id)) - .onItem().apply(RowSet::iterator) - .onItem().apply(iterator -> iterator.hasNext() ? from(iterator.next()) : null); + .onItem().transform(RowSet::iterator) + .onItem().transform(iterator -> iterator.hasNext() ? from(iterator.next()) : null); } public Uni save(PgPool client) { return client.preparedQuery("INSERT INTO fruits (name) VALUES ($1) RETURNING (id)").execute(Tuple.of(name)) - .onItem().apply(pgRowSet -> pgRowSet.iterator().next().getLong("id")); + .onItem().transform(pgRowSet -> pgRowSet.iterator().next().getLong("id")); } public Uni update(PgPool client) { return client.preparedQuery("UPDATE fruits SET name = $1 WHERE id = $2").execute(Tuple.of(name, id)) - .onItem().apply(pgRowSet -> pgRowSet.rowCount() == 1); + .onItem().transform(pgRowSet -> pgRowSet.rowCount() == 1); } public static Uni delete(PgPool client, Long id) { return client.preparedQuery("DELETE FROM fruits WHERE id = $1").execute(Tuple.of(id)) - .onItem().apply(pgRowSet -> pgRowSet.rowCount() == 1); + .onItem().transform(pgRowSet -> pgRowSet.rowCount() == 1); } private static Fruit from(Row row) { diff --git a/vertx-quickstart/src/main/java/org/acme/vertx/FruitResource.java b/vertx-quickstart/src/main/java/org/acme/vertx/FruitResource.java index b51424173b..cf0796ce5b 100644 --- a/vertx-quickstart/src/main/java/org/acme/vertx/FruitResource.java +++ b/vertx-quickstart/src/main/java/org/acme/vertx/FruitResource.java @@ -69,38 +69,38 @@ private void initdb() { @GET public Uni get() { return Fruit.findAll(client) - .onItem().apply(Response::ok) - .onItem().apply(ResponseBuilder::build); + .onItem().transform(Response::ok) + .onItem().transform(ResponseBuilder::build); } @GET @Path("{id}") public Uni getSingle(@PathParam Long id) { return Fruit.findById(client, id) - .onItem().apply(fruit -> fruit != null ? Response.ok(fruit) : Response.status(Status.NOT_FOUND)) - .onItem().apply(ResponseBuilder::build); + .onItem().transform(fruit -> fruit != null ? Response.ok(fruit) : Response.status(Status.NOT_FOUND)) + .onItem().transform(ResponseBuilder::build); } @POST public Uni create(Fruit fruit) { return fruit.save(client) - .onItem().apply(id -> URI.create("/fruits/" + id)) - .onItem().apply(uri -> Response.created(uri).build()); + .onItem().transform(id -> URI.create("/fruits/" + id)) + .onItem().transform(uri -> Response.created(uri).build()); } @PUT @Path("{id}") public Uni update(@PathParam Long id, Fruit fruit) { return fruit.update(client) - .onItem().apply(updated -> updated ? Status.OK : Status.NOT_FOUND) - .onItem().apply(status -> Response.status(status).build()); + .onItem().transform(updated -> updated ? Status.OK : Status.NOT_FOUND) + .onItem().transform(status -> Response.status(status).build()); } @DELETE @Path("{id}") public Uni delete(@PathParam Long id) { return Fruit.delete(client, id) - .onItem().apply(deleted -> deleted ? Status.NO_CONTENT : Status.NOT_FOUND) - .onItem().apply(status -> Response.status(status).build()); + .onItem().transform(deleted -> deleted ? Status.NO_CONTENT : Status.NOT_FOUND) + .onItem().transform(status -> Response.status(status).build()); } }