Skip to content

Commit

Permalink
Remove Vert.x Axle and Vert.x RX managed instances
Browse files Browse the repository at this point in the history
These features have been deprecated in February 2020.
It also simplifies the Vert.x 4 migration, as it reduces the API surface.
  • Loading branch information
cescoffier committed Jan 23, 2021
1 parent d49e1af commit d245d19
Show file tree
Hide file tree
Showing 51 changed files with 134 additions and 1,046 deletions.
81 changes: 10 additions & 71 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@
<reactive-streams.version>1.0.3</reactive-streams.version>
<jboss-logging.version>3.4.1.Final</jboss-logging.version>
<mutiny.version>0.13.0</mutiny.version>
<axle-client.version>1.4.0</axle-client.version>
<mutiny-client.version>1.4.0</mutiny-client.version>
<mutiny-vertx.version>1.4.0</mutiny-vertx.version>
<kafka2.version>2.5.0</kafka2.version>
<zookeeper.version>3.5.7</zookeeper.version>
<!-- Scala is used by Kafka so we need to choose a compatible version -->
Expand Down Expand Up @@ -4040,45 +4039,10 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.smallrye.reactive</groupId>
<artifactId>smallrye-axle-generator</artifactId>
<version>${axle-client.version}</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.smallrye.reactive</groupId>
<artifactId>smallrye-axle-amqp-client</artifactId>
<version>${axle-client.version}</version>
</dependency>
<dependency>
<groupId>io.smallrye.reactive</groupId>
<artifactId>smallrye-axle-core</artifactId>
<version>${axle-client.version}</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.smallrye.reactive</groupId>
<artifactId>smallrye-mutiny-vertx-core</artifactId>
<version>${mutiny-client.version}</version>
<version>${mutiny-vertx.version}</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
Expand All @@ -4090,71 +4054,46 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.smallrye.reactive</groupId>
<artifactId>smallrye-axle-web-client</artifactId>
<version>${axle-client.version}</version>
</dependency>
<dependency>
<groupId>io.smallrye.reactive</groupId>
<artifactId>smallrye-mutiny-vertx-web-client</artifactId>
<version>${mutiny-client.version}</version>
<version>${mutiny-vertx.version}</version>
</dependency>
<dependency>
<groupId>io.smallrye.reactive</groupId>
<artifactId>smallrye-mutiny-vertx-sql-client</artifactId>
<version>${mutiny-client.version}</version>
<version>${mutiny-vertx.version}</version>
</dependency>
<dependency>
<groupId>io.smallrye.reactive</groupId>
<artifactId>smallrye-mutiny-vertx-db2-client</artifactId>
<version>${mutiny-client.version}</version>
<version>${mutiny-vertx.version}</version>
</dependency>
<dependency>
<groupId>io.smallrye.reactive</groupId>
<artifactId>smallrye-mutiny-vertx-mysql-client</artifactId>
<version>${mutiny-client.version}</version>
<version>${mutiny-vertx.version}</version>
</dependency>
<dependency>
<groupId>io.smallrye.reactive</groupId>
<artifactId>smallrye-mutiny-vertx-pg-client</artifactId>
<version>${mutiny-client.version}</version>
<version>${mutiny-vertx.version}</version>
</dependency>
<dependency>
<!-- Used by the Reactive PG Client -->
<groupId>com.ongres.scram</groupId>
<artifactId>client</artifactId>
<version>${scram-client.version}</version>
</dependency>
<dependency>
<groupId>io.smallrye.reactive</groupId>
<artifactId>smallrye-axle-mail-client</artifactId>
<version>${axle-client.version}</version>
</dependency>
<dependency>
<dependency>
<groupId>io.smallrye.reactive</groupId>
<artifactId>smallrye-mutiny-vertx-mail-client</artifactId>
<version>${mutiny-client.version}</version>
<version>${mutiny-vertx.version}</version>
</dependency>
<dependency>
<groupId>io.smallrye.reactive</groupId>
<artifactId>smallrye-mutiny-vertx-redis-client</artifactId>
<version>${mutiny-client.version}</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-rx-java2</artifactId>
<version>${vertx.version}</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
</exclusions>
<version>${mutiny-vertx.version}</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
Expand Down
1 change: 0 additions & 1 deletion build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
<graal-sdk.version-for-documentation>20.3.1</graal-sdk.version-for-documentation>
<mandrel.version-for-documentation>20.3</mandrel.version-for-documentation>
<rest-assured.version>4.3.2</rest-assured.version>
<axle-client.version>1.1.0</axle-client.version>
<mutiny-client.version>1.1.0</mutiny-client.version>
<vertx.version>3.9.2</vertx.version>

Expand Down
2 changes: 0 additions & 2 deletions docs/src/main/asciidoc/mailer.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,6 @@ If you need fine control on how the mail is sent, for instance if you need to re
Three API flavors are exposed:

* the Mutiny client (`io.vertx.mutiny.ext.mail.MailClient`)
* the Axle client (`io.vertx.axle.ext.mail.MailClient`), using `CompletionStage` and Reactive Streams `Publisher` - deprecated, it is recommended to switch to the Mutiny client
* the RX Java 2 client (`io.vertx.reactivex.ext.mail.MailClient`) - deprecated, it is recommended to switch to the Mutiny client
* the bare client (`io.vertx.ext.mail.MailClient`)

Check the link:vertx[Using Vert.x guide] for further details about these different APIs and how to select the most suitable for you.
Expand Down
6 changes: 3 additions & 3 deletions docs/src/main/asciidoc/reactive-routes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,12 @@ Some methods of `RoutingExchange` do it for you, others not and you must call th
A route method can accept arguments of the following types:

* `io.vertx.ext.web.RoutingContext`
* `io.vertx.reactivex.ext.web.RoutingContext`
* `io.vertx.mutiny.ext.web.RoutingContext`
* `io.quarkus.vertx.web.RoutingExchange`
* `io.vertx.core.http.HttpServerRequest`
* `io.vertx.core.http.HttpServerResponse`
* `io.vertx.reactivex.core.http.HttpServerRequest`
* `io.vertx.reactivex.core.http.HttpServerResponse`
* `io.vertx.mutiny.core.http.HttpServerRequest`
* `io.vertx.mutiny.core.http.HttpServerResponse`

Furthermore, it is possible to inject the `HttpServerRequest` parameters into a method parameter annotated with `@io.quarkus.vertx.web.Param`:

Expand Down
45 changes: 3 additions & 42 deletions docs/src/main/asciidoc/vertx.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ Once the extension has been added, you can access the _managed_ Vert.x instance
----

If you are familiar with Vert.x, you know that Vert.x provides different API models.
For instance _bare_ Vert.x uses callbacks, the Mutiny variants uses `Uni` and `Multi`, the RX Java 2 version uses `Single`, `Maybe`, `Completable`, `Observable` and `Flowable`...
The _bare_ Vert.x uses callbacks, while the Mutiny variant uses `Uni` and `Multi`.

Quarkus provides 4 Vert.x APIs:
Quarkus provides 2 Vert.x APIs:

[options="header"]
|===
Expand All @@ -146,21 +146,15 @@ Quarkus provides 4 Vert.x APIs:

| https://smallrye.io/smallrye-mutiny/[Mutiny] | `@Inject io.vertx.mutiny.core.Vertx vertx` | The Mutiny API for Vert.x.

| RX Java 2 | `@Inject io.vertx.reactivex.core.Vertx vertx` | RX Java 2 Vert.x, the API uses RX Java 2 types (deprecated).

| _Axle_ | `@Inject io.vertx.axle.core.Vertx vertx` | Axle Vert.x, the API uses `CompletionStage` and `Reactive Streams` (deprecated).

|===

TIP: You may inject any of the 4 flavors of `Vertx` as well as the `EventBus` in your Quarkus application beans: `bare`, `Mutiny`, `Axle`, `RxJava2`.
TIP: You may inject any of the 2 flavors of `Vertx` as well as the `EventBus` in your Quarkus application beans: `bare` and `Mutiny`.
They are just shims and rely on a single _managed_ Vert.x instance.

You will pick one or the other depending on your use cases.

- `bare`: for advanced usage or if you have existing Vert.x code you want to reuse in your Quarkus application
- `mutiny`: Mutiny is an event-driven reactive programming API. It uses 2 types: `Uni` and `Multi`. This is the recommended API.
- `Axle`: works well with Quarkus and MicroProfile APIs (`CompletionStage` for single results and `Publisher` for streams) - deprecated, it is recommended to switch to Mutiny
- `Rx Java 2`: when you need support for a wide range of data transformation operators on your streams - deprecated, it is recommended to switch to Mutiny

The following snippets illustrate the difference between these 4 APIs:

Expand All @@ -183,25 +177,6 @@ vertx.fileSystem().readFile("lorem-ipsum.txt")
content -> System.out.println("Content: " + content),
err -> System.out.println("Cannot read the file: " + err.getMessage())
);
// Rx Java 2 Vert.x
vertx.fileSystem().rxReadFile("lorem-ipsum.txt")
.map(buffer -> buffer.toString("UTF-8"))
.subscribe(
content -> System.out.println("Content: " + content),
err -> System.out.println("Cannot read the file: " + err.getMessage())
);
// Axle API:
vertx.fileSystem().readFile("lorem-ipsum.txt")
.thenApply(buffer -> buffer.toString("UTF-8"))
.whenComplete((content, err) -> {
if (err != null) {
System.out.println("Cannot read the file: " + err.getMessage());
} else {
System.out.println("Content: " + content);
}
});
----

[TIP]
Expand Down Expand Up @@ -465,22 +440,8 @@ Depending on the API model you want to use you need to add the right dependency
<groupId>io.smallrye.reactive</groupId>
<artifactId>smallrye-mutiny-vertx-web-client</artifactId>
</dependency>
<!-- Axle API -->
<dependency>
<groupId>io.smallrye.reactive</groupId>
<artifactId>smallrye-axle-web-client</artifactId>
</dependency>
<!-- RX Java 2 API -->
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-rx-java2</artifactId>
</dependency>
----

NOTE: The `vertx-rx-java2` provides the RX Java 2 API for the whole Vert.x stack, not only the web client.

In this guide, we are going to use the Mutiny API, so:

[source, xml, subs=attributes+]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ public class InjectionTest {
@RegisterExtension
static final QuarkusUnitTest config = new QuarkusUnitTest()
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
.addClasses(BeanUsingAxleMailClient.class, BeanUsingBareMailClient.class, BeanUsingRxClient.class)
.addClasses(BeanUsingBlockingMailer.class, BeanUsingReactiveMailer.class)
.addClasses(MailTemplates.class)
.addClasses(BeanUsingBareMailClient.class, BeanUsingBlockingMailer.class,
BeanUsingReactiveMailer.class, MailTemplates.class)
.addAsResource("mock-config.properties", "application.properties")
.addAsResource(new StringAsset(""
+ "<html>{name}</html>"), "templates/test1.html")
Expand All @@ -43,13 +42,7 @@ public class InjectionTest {
+ "<html>{name}</html>"), "templates/mails/test2.html"));

@Inject
BeanUsingAxleMailClient beanUsingBare;

@Inject
BeanUsingBareMailClient beanUsingAxle;

@Inject
BeanUsingRxClient beanUsingRx;
BeanUsingBareMailClient beanUsingBare;

@Inject
BeanUsingMutinyClient beanUsingMutiny;
Expand All @@ -69,9 +62,7 @@ public class InjectionTest {
@Test
public void testInjection() {
beanUsingMutiny.verify();
beanUsingAxle.verify();
beanUsingBare.verify();
beanUsingRx.verify();
beanUsingBlockingMailer.verify();
beanUsingReactiveMailer.verify().toCompletableFuture().join();
beanUsingLegacyReactiveMailer.verify().toCompletableFuture().join();
Expand All @@ -91,28 +82,6 @@ void verify() {
}
}

@ApplicationScoped
static class BeanUsingAxleMailClient {

@Inject
io.vertx.axle.ext.mail.MailClient client;

void verify() {
Assertions.assertNotNull(client);
}
}

@ApplicationScoped
static class BeanUsingRxClient {

@Inject
io.vertx.reactivex.ext.mail.MailClient client;

void verify() {
Assertions.assertNotNull(client);
}
}

@ApplicationScoped
static class BeanUsingMutinyClient {

Expand Down
4 changes: 0 additions & 4 deletions extensions/mailer/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@
<groupId>io.smallrye.reactive</groupId>
<artifactId>smallrye-mutiny-vertx-mail-client</artifactId>
</dependency>
<dependency>
<groupId>io.smallrye.reactive</groupId>
<artifactId>smallrye-axle-mail-client</artifactId>
</dependency>
<dependency>
<groupId>org.subethamail</groupId>
<artifactId>subethasmtp</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,6 @@ public io.vertx.mutiny.ext.mail.MailClient mutinyClient() {
return mutinyClient;
}

@Singleton
@Produces
@Deprecated
public io.vertx.axle.ext.mail.MailClient axleMailClient() {
LOGGER.warn(
"`io.vertx.axle.ext.mail.MailClient` is deprecated and will be removed in a future version - it is "
+ "recommended to switch to `io.vertx.mutiny.ext.mail.MailClient`");
return io.vertx.axle.ext.mail.MailClient.newInstance(client);
}

@Singleton
@Produces
@Deprecated
public io.vertx.reactivex.ext.mail.MailClient rxMailClient() {
LOGGER.warn(
"`io.vertx.reactivex.ext.mail.MailClient` is deprecated and will be removed in a future version - it is "
+ "recommended to switch to `io.vertx.mutiny.ext.mail.MailClient`");
return io.vertx.reactivex.ext.mail.MailClient.newInstance(client);
}

@PreDestroy
public void stop() {
client.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@
import java.util.List;
import java.util.Map;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

import io.smallrye.mutiny.Multi;
import io.vertx.axle.core.Vertx;

class MailTest {

Expand All @@ -24,17 +21,6 @@ class MailTest {
private static final String DESCRIPTION = "my lorem ipsum";
private static final String TO_ADDRESS = "[email protected]";
private static final String TEXT_PLAIN = "text/plain";
private static Vertx vertx;

@BeforeAll
static void init() {
vertx = Vertx.vertx();
}

@AfterAll
static void closing() {
vertx.close().toCompletableFuture().join();
}

@Test
void testSimpleTextEmail() {
Expand Down
Loading

0 comments on commit d245d19

Please sign in to comment.