diff --git a/vertx-core/src/main/asciidoc/index.adoc b/vertx-core/src/main/asciidoc/index.adoc index e3e9e998be4..6e33706bc86 100644 --- a/vertx-core/src/main/asciidoc/index.adoc +++ b/vertx-core/src/main/asciidoc/index.adoc @@ -794,9 +794,19 @@ If you are using Vert.x from a Maven or Gradle project just add the cluster mana For more information on this, please consult https://vertx.io/docs/#clustering -=== Programmatic SPI selection and configuration +== Vert.x Builder -The {@link io.vertx.core.VertxBuilder} gives you more control over the SPI selection and configuration. +{@link io.vertx.core.Vertx#vertx()} and {@link io.vertx.core.Vertx#clusteredVertx(io.vertx.core.VertxOptions)} static +methods are the easiest way obtain an instance of {@link io.vertx.core.Vertx}. + +You can also use the https://en.wikipedia.org/wiki/Builder_pattern[builder pattern] to create a `Vertx` instance. The builder +lets you programmatically configure a few providers (SPI) which are usually loaded using `VertxOptions` and/or Java +Service Loader plugins. + +- Native <<_native_transports, transport>> +- Cluster manager +- Tracing +- Metrics instance [source,$lang] ---- diff --git a/vertx-core/src/main/java/examples/CoreExamples.java b/vertx-core/src/main/java/examples/CoreExamples.java index d6aaa475680..7ce9403e58a 100644 --- a/vertx-core/src/main/java/examples/CoreExamples.java +++ b/vertx-core/src/main/java/examples/CoreExamples.java @@ -24,6 +24,7 @@ import io.vertx.core.net.NetServer; import io.vertx.core.net.SocketAddress; import io.vertx.core.spi.VertxMetricsFactory; +import io.vertx.core.spi.VertxTracerFactory; import io.vertx.core.spi.cluster.ClusterManager; import io.vertx.core.transport.Transport; @@ -111,9 +112,10 @@ String blockingMethod(String str) { } } - public void vertxBuilder(VertxOptions options, VertxMetricsFactory metricsFactory) { + public void vertxBuilder(VertxOptions options, VertxMetricsFactory metricsFactory, VertxTracerFactory tracerFactory) { Vertx vertx = Vertx.builder() .with(options) + .withTracer(tracerFactory) .withMetrics(metricsFactory) .build(); }