Class Vertx
- All Implemented Interfaces:
MutinyDelegate,Measured
You use an instance of this class for functionality including:
- Creating TCP clients and servers
- Creating HTTP clients and servers
- Creating DNS clients
- Creating Datagram sockets
- Setting and cancelling periodic and one-shot timers
- Getting a reference to the event bus API
- Getting a reference to the file system API
- Getting a reference to the shared data API
- Deploying and undeploying verticles
Most functionality in Vert.x core is fairly low level.
To create an instance of this class you can use the static factory methods: vertx(),
vertx(io.vertx.core.VertxOptions) and clusteredVertx(io.vertx.core.VertxOptions).
Please see the user manual for more detailed usage information.
NOTE: This class has been automatically generated from the original non Mutiny-ified interface.
- Author:
- Tim Fox, Julien Viet
- See Also:
-
Vertx
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.vertx.mutiny.core.metrics.Measured
Measured.MeasuredImpl -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic VertxBuilderbuilder()Return a builder for Vert.x instances which allows to specify SPI such as cluster manager, metrics or tracing.booleancancelTimer(long id) Cancels the timer with the specifiedid.io.smallrye.mutiny.Uni<Void>close()Stop the Vertx instance and release any resources held by it.voidStop the Vertx instance and release any resources held by it.Stop the Vertx instance and release any resources held by it.static io.smallrye.mutiny.Uni<Vertx>clusteredVertx(io.vertx.core.VertxOptions options) Creates a clustered instance using the specified options.static VertxclusteredVertxAndAwait(io.vertx.core.VertxOptions options) Creates a clustered instance using the specified options.static voidclusteredVertxAndForget(io.vertx.core.VertxOptions options) Creates a clustered instance using the specified options.Create a datagram socket using default optionscreateDatagramSocket(io.vertx.core.datagram.DatagramSocketOptions options) Create a datagram socket using the specified optionsCreate a DNS client to connect to the DNS server configured byVertxOptions.getAddressResolverOptions()createDnsClient(int port, String host) Create a DNS client to connect to a DNS server at the specified host and port, with the default query timeout (5 seconds)createDnsClient(io.vertx.core.dns.DnsClientOptions options) Create a DNS client to connect to a DNS serverCreate a HTTP/HTTPS client using default optionscreateHttpClient(io.vertx.core.http.HttpClientConfig config) Create an HTTP/HTTPS client using the specified configcreateHttpClient(io.vertx.core.http.HttpClientConfig clientConfig, io.vertx.core.http.PoolOptions poolOptions) Create a HTTP/HTTPS client using the specified client and pool optionscreateHttpClient(io.vertx.core.http.HttpClientConfig clientConfig, io.vertx.core.net.ClientSSLOptions sslOptions) Create a HTTP/HTTPS client using the specified client and ssl optionscreateHttpClient(io.vertx.core.http.HttpClientConfig clientConfig, io.vertx.core.net.ClientSSLOptions sslOptions, io.vertx.core.http.PoolOptions poolOptions) Create a HTTP/HTTPS client using the specified client, ssl options and pool optionscreateHttpClient(io.vertx.core.http.HttpClientOptions clientOptions) Create a HTTP/HTTPS client using the specified client optionscreateHttpClient(io.vertx.core.http.HttpClientOptions clientOptions, io.vertx.core.http.PoolOptions poolOptions) Create a HTTP/HTTPS client using the specified client and pool optionscreateHttpClient(io.vertx.core.http.PoolOptions poolOptions) Create a HTTP/HTTPS client using the specified pool optionsCreate an HTTP/HTTPS server using default config.createHttpServer(io.vertx.core.http.HttpServerConfig config) Create an HTTP server using the specifiedconfig.createHttpServer(io.vertx.core.http.HttpServerConfig config, io.vertx.core.net.ServerSSLOptions sslOptions) Create an HTTP server using the specified config and the specifiedsslOptionscreateHttpServer(io.vertx.core.http.HttpServerOptions options) Create an HTTP/HTTPS server using the specifiedoptionscreateHttpServer(io.vertx.core.net.ServerSSLOptions sslOptions) Create an HTTP server using default config and the specifiedsslOptions.Create a TCP/SSL client using default optionscreateNetClient(io.vertx.core.net.NetClientOptions options) Create a TCP/SSL client using the specified optionscreateNetClient(io.vertx.core.net.TcpClientConfig config) Create a TCP/SSL client using the specified configcreateNetClient(io.vertx.core.net.TcpClientConfig config, io.vertx.core.net.ClientSSLOptions sslOptions) Create a TCP/SSL client using the specified config and the specified ssl optionsCreate a TCP/SSL server using default optionscreateNetServer(io.vertx.core.net.NetServerOptions options) Create a TCP/SSL server using the specified optionscreateNetServer(io.vertx.core.net.TcpServerConfig config) Create a TCP/SSL server using the specified configcreateNetServer(io.vertx.core.net.TcpServerConfig config, io.vertx.core.net.ServerSSLOptions sslOptions) Create a TCP/SSL server using the specified config and the specified ssl optionscreateQuicClient(io.vertx.core.net.ClientSSLOptions defaultSslOptions) LikecreateQuicClient(QuicClientConfig, ClientSSLOptions), with the default client configuration.createQuicClient(io.vertx.core.net.QuicClientConfig config) Create a configured Quic client.createQuicClient(io.vertx.core.net.QuicClientConfig config, io.vertx.core.net.ClientSSLOptions sslOptions) Create a configured Quic client.createQuicServer(io.vertx.core.net.QuicServerConfig config, io.vertx.core.net.ServerSSLOptions sslOptions) Create a configured Quic server.createQuicServer(io.vertx.core.net.ServerSSLOptions sslOptions) LikecreateQuicServer(QuicServerConfig, ServerSSLOptions), with the default server configuration.LikecreateSharedWorkerExecutor(String, int)but with theVertxOptions.setWorkerPoolSize(int)poolSize.createSharedWorkerExecutor(String name, int poolSize) LikecreateSharedWorkerExecutor(String, int, long)but with theVertxOptions.setMaxWorkerExecuteTime(long)maxExecuteTime.createSharedWorkerExecutor(String name, int poolSize, long maxExecuteTime) LikecreateSharedWorkerExecutor(String, int, long, TimeUnit)but with theVertxOptions.setMaxWorkerExecuteTimeUnit(TimeUnit)maxExecuteTimeUnit.createSharedWorkerExecutor(String name, int poolSize, long maxExecuteTime, TimeUnit maxExecuteTimeUnit) Create a named worker executor, the executor should be closed when it's not needed anymore to release resources.Create a WebSocket client using default optionscreateWebSocketClient(io.vertx.core.http.WebSocketClientOptions options) Create a WebSocket client using the specified optionsstatic ContextGets the current contextReturn a Set of deployment IDs for the currently deployed deploymentIDs.io.smallrye.mutiny.Uni<String>deployVerticle(io.vertx.core.Deployable verticle) Deploy a verticle instance that you have created yourself.io.smallrye.mutiny.Uni<String>deployVerticle(io.vertx.core.Deployable verticle, io.vertx.core.DeploymentOptions options) LikedeployVerticle(Deployable)butDeploymentOptionsare provided to configure the deployment.io.smallrye.mutiny.Uni<String>deployVerticle(String name) Deploy a verticle instance given a name.io.smallrye.mutiny.Uni<String>deployVerticle(String name, io.vertx.core.DeploymentOptions options) LikedeployVerticle(Deployable)butDeploymentOptionsare provided to configure the deployment.io.smallrye.mutiny.Uni<String>deployVerticle(Supplier<? extends io.vertx.core.Deployable> supplier, io.vertx.core.DeploymentOptions options) LikedeployVerticle(Deployable, DeploymentOptions)butDeployableinstance is created by invoking theverticleSupplier.deployVerticleAndAwait(io.vertx.core.Deployable verticle) Deploy a verticle instance that you have created yourself.deployVerticleAndAwait(io.vertx.core.Deployable verticle, io.vertx.core.DeploymentOptions options) LikedeployVerticle(Deployable)butDeploymentOptionsare provided to configure the deployment.deployVerticleAndAwait(String name) Deploy a verticle instance given a name.deployVerticleAndAwait(String name, io.vertx.core.DeploymentOptions options) LikedeployVerticle(Deployable)butDeploymentOptionsare provided to configure the deployment.deployVerticleAndAwait(Supplier<? extends io.vertx.core.Deployable> supplier, io.vertx.core.DeploymentOptions options) LikedeployVerticle(Deployable, DeploymentOptions)butDeployableinstance is created by invoking theverticleSupplier.deployVerticleAndForget(io.vertx.core.Deployable verticle) Deploy a verticle instance that you have created yourself.deployVerticleAndForget(io.vertx.core.Deployable verticle, io.vertx.core.DeploymentOptions options) LikedeployVerticle(Deployable)butDeploymentOptionsare provided to configure the deployment.Deploy a verticle instance given a name.deployVerticleAndForget(String name, io.vertx.core.DeploymentOptions options) LikedeployVerticle(Deployable)butDeploymentOptionsare provided to configure the deployment.deployVerticleAndForget(Supplier<? extends io.vertx.core.Deployable> supplier, io.vertx.core.DeploymentOptions options) LikedeployVerticle(Deployable, DeploymentOptions)butDeployableinstance is created by invoking theverticleSupplier.booleaneventBus()Get the event bus object.exceptionHandler(Consumer<Throwable> handler) Set a default exception handler forContext, set onContext#exceptionHandler(Handler)at creation.<T> io.smallrye.mutiny.Uni<T>executeBlocking(Callable<T> blockingCodeHandler) LikeexecuteBlocking(Callable, boolean)called with ordered = true.<T> io.smallrye.mutiny.Uni<T>executeBlocking(Callable<T> blockingCodeHandler, boolean ordered) Safely execute some blocking code.<T> TexecuteBlockingAndAwait(Callable<T> blockingCodeHandler) LikeexecuteBlocking(Callable, boolean)called with ordered = true.<T> TexecuteBlockingAndAwait(Callable<T> blockingCodeHandler, boolean ordered) Safely execute some blocking code.<T> VertxexecuteBlockingAndForget(Callable<T> blockingCodeHandler) LikeexecuteBlocking(Callable, boolean)called with ordered = true.<T> VertxexecuteBlockingAndForget(Callable<T> blockingCodeHandler, boolean ordered) Safely execute some blocking code.Get the filesystem object.io.vertx.core.VertxGet the delegate instance.Gets the current context, or creates one if there isn't oneinthashCode()Provide a builder forHttpClient, it can be used to configure advanced HTTP client settings like a redirect handler or a connection handler.Provide a builder forHttpServer, it can be used to configure advanced HTTP servre settings like a connection handler.booleanIs this Vert.x instance clustered?booleanWhether the metrics are enabled for this measured objectbooleanstatic VertxnewInstance(io.vertx.core.Vertx delegate) Creates a new instance of theVertx.voidregisterVerticleFactory(io.vertx.core.spi.VerticleFactory factory) Register aVerticleFactorythat can be used for deploying Verticles based on an identifier.voidrunOnContext(Runnable action) Puts the handler on the event queue for the current context so it will be run asynchronously ASAP after all preceeding events have been handled.longsetPeriodic(long initialDelay, long delay, Consumer<Long> handler) Set a periodic timer to fire everydelaymilliseconds with initial delay, at which pointhandlerwill be called with the id of the timer.longsetPeriodic(long delay, Consumer<Long> handler) Set a periodic timer to fire everydelaymilliseconds, at which pointhandlerwill be called with the id of the timer.longSet a one-shot timer to fire afterdelaymilliseconds, at which pointhandlerwill be called with the id of the timer.Get the shared data object.timer(long delay) Liketimer(long, TimeUnit)with a unit in millis.Create a timer task configured with the specifieddelay, when the timeout fires the timer future is succeeded, when the timeout is cancelled the timer future is failed with aCancellationExceptioninstance.toString()io.smallrye.mutiny.Uni<Void>Undeploy a verticle deployment.voidundeployAndAwait(String deploymentID) Undeploy a verticle deployment.undeployAndForget(String deploymentID) Undeploy a verticle deployment.voidunregisterVerticleFactory(io.vertx.core.spi.VerticleFactory factory) Unregister aVerticleFactorySet<io.vertx.core.spi.VerticleFactory>Return the Set of currently registered verticle factories.static Vertxvertx()Creates a non clustered instance using default options.static Vertxvertx(io.vertx.core.VertxOptions options) Creates a non clustered instance using the specified options
-
Field Details
-
__TYPE_ARG
-
-
Constructor Details
-
Vertx
public Vertx(io.vertx.core.Vertx delegate) Create a new instance ofVertxdelegating to the given (non-null) instance ofVertx. -
Vertx
-
-
Method Details
-
getDelegate
public io.vertx.core.Vertx getDelegate()Get the delegate instance.This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.
- Specified by:
getDelegatein interfaceMeasured- Specified by:
getDelegatein interfaceMutinyDelegate- Returns:
- the delegate instance
-
clusteredVertx
@CheckReturnValue public static io.smallrye.mutiny.Uni<Vertx> clusteredVertx(io.vertx.core.VertxOptions options) Creates a clustered instance using the specified options.The instance is created asynchronously and the returned uni is completed with the result when it is ready.
Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
options- the options to use- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
Vertx.clusteredVertx(VertxOptions)
-
clusteredVertxAndAwait
Creates a clustered instance using the specified options.The instance is created asynchronously and the returned underlying uni is completed with the result when it is ready.
Unlike the bare Vert.x variant, this method returns a
Vertx. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in aRuntimeException).- Parameters:
options- the options to use- Returns:
- The operation result
- See Also:
-
Vertx.clusteredVertx(VertxOptions)
-
clusteredVertxAndForget
public static void clusteredVertxAndForget(io.vertx.core.VertxOptions options) Creates a clustered instance using the specified options.The instance is created asynchronously and the returned underlying uni is completed with the result when it is ready.
Unlike the bare Vert.x variant, this method ignores the
Vertxresult or any failure.- Parameters:
options- the options to use- See Also:
-
Vertx.clusteredVertx(VertxOptions)
-
close
Stop the Vertx instance and release any resources held by it.The instance cannot be used after it has been closed.
The actual close is asynchronous and may not complete until after the call has returned.
Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
Vertx.close()
-
closeAndAwait
public void closeAndAwait()Stop the Vertx instance and release any resources held by it.The instance cannot be used after it has been closed.
The actual close is asynchronous and may not complete until after the call has returned.
Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in aRuntimeException).- See Also:
-
Vertx.close()
-
closeAndForget
Stop the Vertx instance and release any resources held by it.The instance cannot be used after it has been closed.
The actual close is asynchronous and may not complete until after the call has returned.
Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
Vertx.close()
-
deployVerticle
@CheckReturnValue public io.smallrye.mutiny.Uni<String> deployVerticle(io.vertx.core.Deployable verticle) Deploy a verticle instance that you have created yourself.Vert.x will assign the verticle a context and start the verticle.
The actual deploy happens asynchronously and may not complete until after the call has returned.
If the deployment is successful the result will contain a string representing the unique deployment ID of the deployment.
This deployment ID can subsequently be used to undeploy the verticle.
Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
verticle- the verticle instance to deploy.- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
Vertx.deployVerticle(Deployable)
-
deployVerticleAndAwait
Deploy a verticle instance that you have created yourself.Vert.x will assign the verticle a context and start the verticle.
The actual deploy happens asynchronously and may not complete until after the call has returned.
If the deployment is successful the result will contain a string representing the unique deployment ID of the deployment.
This deployment ID can subsequently be used to undeploy the verticle.
Unlike the bare Vert.x variant, this method returns a
String. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in aRuntimeException).- Parameters:
verticle- the verticle instance to deploy.- Returns:
- The operation result
- See Also:
-
Vertx.deployVerticle(Deployable)
-
deployVerticleAndForget
Deploy a verticle instance that you have created yourself.Vert.x will assign the verticle a context and start the verticle.
The actual deploy happens asynchronously and may not complete until after the call has returned.
If the deployment is successful the result will contain a string representing the unique deployment ID of the deployment.
This deployment ID can subsequently be used to undeploy the verticle.
Unlike the bare Vert.x variant, this method ignores the
Stringresult or any failure.- Parameters:
verticle- the verticle instance to deploy.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
Vertx.deployVerticle(Deployable)
-
deployVerticle
@CheckReturnValue public io.smallrye.mutiny.Uni<String> deployVerticle(io.vertx.core.Deployable verticle, io.vertx.core.DeploymentOptions options) LikedeployVerticle(Deployable)butDeploymentOptionsare provided to configure the deployment.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
verticle- the verticle instance to deployoptions- the deployment options.- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
Vertx.deployVerticle(Deployable, DeploymentOptions)
-
deployVerticleAndAwait
public String deployVerticleAndAwait(io.vertx.core.Deployable verticle, io.vertx.core.DeploymentOptions options) LikedeployVerticle(Deployable)butDeploymentOptionsare provided to configure the deployment.Unlike the bare Vert.x variant, this method returns a
String. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in aRuntimeException).- Parameters:
verticle- the verticle instance to deployoptions- the deployment options.- Returns:
- The operation result
- See Also:
-
Vertx.deployVerticle(Deployable, DeploymentOptions)
-
deployVerticleAndForget
public Vertx deployVerticleAndForget(io.vertx.core.Deployable verticle, io.vertx.core.DeploymentOptions options) LikedeployVerticle(Deployable)butDeploymentOptionsare provided to configure the deployment.Unlike the bare Vert.x variant, this method ignores the
Stringresult or any failure.- Parameters:
verticle- the verticle instance to deployoptions- the deployment options.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
Vertx.deployVerticle(Deployable, DeploymentOptions)
-
deployVerticle
@CheckReturnValue public io.smallrye.mutiny.Uni<String> deployVerticle(Supplier<? extends io.vertx.core.Deployable> supplier, io.vertx.core.DeploymentOptions options) LikedeployVerticle(Deployable, DeploymentOptions)butDeployableinstance is created by invoking theverticleSupplier.The supplier will be invoked as many times as
DeploymentOptions.getInstances(). It must not return the same instance twice.Note that the supplier will be invoked on the caller thread.
Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
Vertx.deployVerticle(Supplier, DeploymentOptions)
-
deployVerticleAndAwait
public String deployVerticleAndAwait(Supplier<? extends io.vertx.core.Deployable> supplier, io.vertx.core.DeploymentOptions options) LikedeployVerticle(Deployable, DeploymentOptions)butDeployableinstance is created by invoking theverticleSupplier.The supplier will be invoked as many times as
DeploymentOptions.getInstances(). It must not return the same instance twice.Note that the supplier will be invoked on the caller thread.
Unlike the bare Vert.x variant, this method returns a
String. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in aRuntimeException).- Returns:
- The operation result
- See Also:
-
Vertx.deployVerticle(Supplier, DeploymentOptions)
-
deployVerticleAndForget
public Vertx deployVerticleAndForget(Supplier<? extends io.vertx.core.Deployable> supplier, io.vertx.core.DeploymentOptions options) LikedeployVerticle(Deployable, DeploymentOptions)butDeployableinstance is created by invoking theverticleSupplier.The supplier will be invoked as many times as
DeploymentOptions.getInstances(). It must not return the same instance twice.Note that the supplier will be invoked on the caller thread.
Unlike the bare Vert.x variant, this method ignores the
Stringresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
Vertx.deployVerticle(Supplier, DeploymentOptions)
-
deployVerticle
Deploy a verticle instance given a name.Given the name, Vert.x selects a
VerticleFactoryinstance to use to instantiate the verticle.For the rules on how factories are selected please consult the user manual.
If the deployment is successful the result will contain a String representing the unique deployment ID of the deployment.
This deployment ID can subsequently be used to undeploy the verticle.
Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
name- the name.- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
Vertx.deployVerticle(String)
-
deployVerticleAndAwait
Deploy a verticle instance given a name.Given the name, Vert.x selects a
VerticleFactoryinstance to use to instantiate the verticle.For the rules on how factories are selected please consult the user manual.
If the deployment is successful the result will contain a String representing the unique deployment ID of the deployment.
This deployment ID can subsequently be used to undeploy the verticle.
Unlike the bare Vert.x variant, this method returns a
String. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in aRuntimeException).- Parameters:
name- the name.- Returns:
- The operation result
- See Also:
-
Vertx.deployVerticle(String)
-
deployVerticleAndForget
Deploy a verticle instance given a name.Given the name, Vert.x selects a
VerticleFactoryinstance to use to instantiate the verticle.For the rules on how factories are selected please consult the user manual.
If the deployment is successful the result will contain a String representing the unique deployment ID of the deployment.
This deployment ID can subsequently be used to undeploy the verticle.
Unlike the bare Vert.x variant, this method ignores the
Stringresult or any failure.- Parameters:
name- the name.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
Vertx.deployVerticle(String)
-
deployVerticle
@CheckReturnValue public io.smallrye.mutiny.Uni<String> deployVerticle(String name, io.vertx.core.DeploymentOptions options) LikedeployVerticle(Deployable)butDeploymentOptionsare provided to configure the deployment.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
name- the nameoptions- the deployment options.- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
Vertx.deployVerticle(String, DeploymentOptions)
-
deployVerticleAndAwait
LikedeployVerticle(Deployable)butDeploymentOptionsare provided to configure the deployment.Unlike the bare Vert.x variant, this method returns a
String. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in aRuntimeException).- Parameters:
name- the nameoptions- the deployment options.- Returns:
- The operation result
- See Also:
-
Vertx.deployVerticle(String, DeploymentOptions)
-
deployVerticleAndForget
LikedeployVerticle(Deployable)butDeploymentOptionsare provided to configure the deployment.Unlike the bare Vert.x variant, this method ignores the
Stringresult or any failure.- Parameters:
name- the nameoptions- the deployment options.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
Vertx.deployVerticle(String, DeploymentOptions)
-
undeploy
Undeploy a verticle deployment.The actual undeployment happens asynchronously and may not complete until after the method has returned.
Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
deploymentID- the deployment ID- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
Vertx.undeploy(String)
-
undeployAndAwait
Undeploy a verticle deployment.The actual undeployment happens asynchronously and may not complete until after the method has returned.
Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in aRuntimeException).- Parameters:
deploymentID- the deployment ID- See Also:
-
Vertx.undeploy(String)
-
undeployAndForget
Undeploy a verticle deployment.The actual undeployment happens asynchronously and may not complete until after the method has returned.
Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Parameters:
deploymentID- the deployment ID- Returns:
- The current instance to chain operations if needed.
- See Also:
-
Vertx.undeploy(String)
-
executeBlocking
@CheckReturnValue public <T> io.smallrye.mutiny.Uni<T> executeBlocking(Callable<T> blockingCodeHandler, boolean ordered) Safely execute some blocking code.Executes the blocking code in the handler
blockingCodeHandlerusing a thread from the worker pool.The returned uni will be completed with the result on the original context (i.e. on the original event loop of the caller) or failed when the handler throws an exception.
In the
blockingCodeHandlerthe current context remains the original context and therefore any task scheduled in theblockingCodeHandlerwill be executed on this context and not on the worker thread.The blocking code should block for a reasonable amount of time (i.e no more than a few seconds). Long blocking operations or polling operations (i.e a thread that spin in a loop polling events in a blocking fashion) are precluded.
When the blocking operation lasts more than the 10 seconds, a message will be printed on the console by the blocked thread checker.
Long blocking operations should use a dedicated thread managed by the application, which can interact with verticles using the event-bus or
Context#runOnContext(Handler)Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Type Parameters:
T- the type of the result- Parameters:
blockingCodeHandler- handler representing the blocking code to runordered- if true then if executeBlocking is called several times on the same context, the executions for that context will be executed serially, not in parallel. if false then they will be no ordering guarantees- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
Vertx.executeBlocking(Callable, boolean)
-
executeBlockingAndAwait
Safely execute some blocking code.Executes the blocking code in the handler
blockingCodeHandlerusing a thread from the worker pool.The returned underlying uni will be completed with the result on the original context (i.e. on the original event loop of the caller) or failed when the handler throws an exception.
In the
blockingCodeHandlerthe current context remains the original context and therefore any task scheduled in theblockingCodeHandlerwill be executed on this context and not on the worker thread.The blocking code should block for a reasonable amount of time (i.e no more than a few seconds). Long blocking operations or polling operations (i.e a thread that spin in a loop polling events in a blocking fashion) are precluded.
When the blocking operation lasts more than the 10 seconds, a message will be printed on the console by the blocked thread checker.
Long blocking operations should use a dedicated thread managed by the application, which can interact with verticles using the event-bus or
Context#runOnContext(Handler)Unlike the bare Vert.x variant, this method returns a
Vertx. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in aRuntimeException).- Type Parameters:
T- the type of the result- Parameters:
blockingCodeHandler- handler representing the blocking code to runordered- if true then if executeBlocking is called several times on the same context, the executions for that context will be executed serially, not in parallel. if false then they will be no ordering guarantees- Returns:
- The operation result
- See Also:
-
Vertx.executeBlocking(Callable, boolean)
-
executeBlockingAndForget
Safely execute some blocking code.Executes the blocking code in the handler
blockingCodeHandlerusing a thread from the worker pool.The returned underlying uni will be completed with the result on the original context (i.e. on the original event loop of the caller) or failed when the handler throws an exception.
In the
blockingCodeHandlerthe current context remains the original context and therefore any task scheduled in theblockingCodeHandlerwill be executed on this context and not on the worker thread.The blocking code should block for a reasonable amount of time (i.e no more than a few seconds). Long blocking operations or polling operations (i.e a thread that spin in a loop polling events in a blocking fashion) are precluded.
When the blocking operation lasts more than the 10 seconds, a message will be printed on the console by the blocked thread checker.
Long blocking operations should use a dedicated thread managed by the application, which can interact with verticles using the event-bus or
Context#runOnContext(Handler)Unlike the bare Vert.x variant, this method ignores the
Vertxresult or any failure.- Type Parameters:
T- the type of the result- Parameters:
blockingCodeHandler- handler representing the blocking code to runordered- if true then if executeBlocking is called several times on the same context, the executions for that context will be executed serially, not in parallel. if false then they will be no ordering guarantees- Returns:
- The current instance to chain operations if needed.
- See Also:
-
Vertx.executeBlocking(Callable, boolean)
-
executeBlocking
@CheckReturnValue public <T> io.smallrye.mutiny.Uni<T> executeBlocking(Callable<T> blockingCodeHandler) LikeexecuteBlocking(Callable, boolean)called with ordered = true.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
Vertx.executeBlocking(Callable)
-
executeBlockingAndAwait
LikeexecuteBlocking(Callable, boolean)called with ordered = true.Unlike the bare Vert.x variant, this method returns a
Vertx. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in aRuntimeException).- Returns:
- The operation result
- See Also:
-
Vertx.executeBlocking(Callable)
-
executeBlockingAndForget
LikeexecuteBlocking(Callable, boolean)called with ordered = true.Unlike the bare Vert.x variant, this method ignores the
Vertxresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
Vertx.executeBlocking(Callable)
-
builder
Return a builder for Vert.x instances which allows to specify SPI such as cluster manager, metrics or tracing.- Returns:
- a Vert.x instance builder
-
vertx
Creates a non clustered instance using default options.- Returns:
- the instance
-
vertx
Creates a non clustered instance using the specified options- Parameters:
options- the options to use- Returns:
- the instance
-
currentContext
Gets the current context- Returns:
- The current context or
nullif there is no current context
-
getOrCreateContext
Gets the current context, or creates one if there isn't one- Returns:
- The current context (created if didn't exist)
-
createNetServer
Create a TCP/SSL server using the specified config- Parameters:
config- the config to use- Returns:
- the server
-
createNetServer
public NetServer createNetServer(io.vertx.core.net.TcpServerConfig config, io.vertx.core.net.ServerSSLOptions sslOptions) Create a TCP/SSL server using the specified config and the specified ssl options- Parameters:
config- the config to usesslOptions- the server SSL options- Returns:
- the server
-
createNetServer
Create a TCP/SSL server using the specified options- Parameters:
options- the options to use- Returns:
- the server
-
createNetServer
Create a TCP/SSL server using default options- Returns:
- the server
-
createNetClient
Create a TCP/SSL client using the specified config- Parameters:
config- the config to use- Returns:
- the client
-
createNetClient
public NetClient createNetClient(io.vertx.core.net.TcpClientConfig config, io.vertx.core.net.ClientSSLOptions sslOptions) Create a TCP/SSL client using the specified config and the specified ssl options- Parameters:
config- the config to usesslOptions- the default client SSL options- Returns:
- the client
-
createNetClient
Create a TCP/SSL client using the specified options- Parameters:
options- the options to use- Returns:
- the client
-
createNetClient
Create a TCP/SSL client using default options- Returns:
- the client
-
createQuicServer
public QuicServer createQuicServer(io.vertx.core.net.QuicServerConfig config, io.vertx.core.net.ServerSSLOptions sslOptions) Create a configured Quic server.
The returned server can be bound, after setting a connection
handler- Parameters:
config- the server configurationsslOptions- the server SSL options- Returns:
- the server
-
createQuicServer
LikecreateQuicServer(QuicServerConfig, ServerSSLOptions), with the default server configuration. -
createQuicClient
public QuicClient createQuicClient(io.vertx.core.net.QuicClientConfig config, io.vertx.core.net.ClientSSLOptions sslOptions) Create a configured Quic client.
- Parameters:
config- the client configurationsslOptions- the default client SSL options- Returns:
- the client
-
createQuicClient
LikecreateQuicClient(QuicClientConfig, ClientSSLOptions), with the default client configuration. -
createQuicClient
Create a configured Quic client.
- Parameters:
config- the client configuration- Returns:
- the client
-
createHttpServer
Create an HTTP/HTTPS server using the specifiedoptions- Parameters:
options- the options to use- Returns:
- the server
-
createHttpServer
Create an HTTP server using the specifiedconfig.- Parameters:
config- the config to use- Returns:
- the server
-
createHttpServer
public HttpServer createHttpServer(io.vertx.core.http.HttpServerConfig config, io.vertx.core.net.ServerSSLOptions sslOptions) Create an HTTP server using the specified config and the specifiedsslOptions- Parameters:
config- the config to usesslOptions- the ssl options to use- Returns:
- the server
-
createHttpServer
Create an HTTP server using default config and the specifiedsslOptions.- Parameters:
sslOptions- the ssl options to use- Returns:
- the server
-
createHttpServer
Create an HTTP/HTTPS server using default config.- Returns:
- the server
-
httpServerBuilder
Provide a builder forHttpServer, it can be used to configure advanced HTTP servre settings like a connection handler.Example usage:
HttpServer server = vertx.httpServerBuilder().with(options).withConnectHandler(conn -> ...).build() -
createWebSocketClient
Create a WebSocket client using default options- Returns:
- the client
-
createWebSocketClient
Create a WebSocket client using the specified options- Parameters:
options- the options to use- Returns:
- the client
-
httpClientBuilder
Provide a builder forHttpClient, it can be used to configure advanced HTTP client settings like a redirect handler or a connection handler.Example usage:
HttpClient client = vertx.httpClientBuilder().with(options).withConnectHandler(conn -> ...).build() -
createHttpClient
public HttpClientAgent createHttpClient(io.vertx.core.http.HttpClientConfig clientConfig, io.vertx.core.http.PoolOptions poolOptions) Create a HTTP/HTTPS client using the specified client and pool options- Parameters:
clientConfig- the client config to usepoolOptions- the pool options to use- Returns:
- the client
-
createHttpClient
public HttpClientAgent createHttpClient(io.vertx.core.http.HttpClientConfig clientConfig, io.vertx.core.net.ClientSSLOptions sslOptions, io.vertx.core.http.PoolOptions poolOptions) Create a HTTP/HTTPS client using the specified client, ssl options and pool options- Parameters:
clientConfig- the client config to usesslOptions- the ssl options to usepoolOptions- the pool options to use- Returns:
- the client
-
createHttpClient
public HttpClientAgent createHttpClient(io.vertx.core.http.HttpClientConfig clientConfig, io.vertx.core.net.ClientSSLOptions sslOptions) Create a HTTP/HTTPS client using the specified client and ssl options- Parameters:
clientConfig- the client config to usesslOptions- the ssl options to use- Returns:
- the client
-
createHttpClient
public HttpClientAgent createHttpClient(io.vertx.core.http.HttpClientOptions clientOptions, io.vertx.core.http.PoolOptions poolOptions) Create a HTTP/HTTPS client using the specified client and pool options- Parameters:
clientOptions- the client options to usepoolOptions- the pool options to use- Returns:
- the client
-
createHttpClient
Create an HTTP/HTTPS client using the specified config- Parameters:
config- the config to use- Returns:
- the server
-
createHttpClient
Create a HTTP/HTTPS client using the specified client options- Parameters:
clientOptions- the options to use- Returns:
- the client
-
createHttpClient
Create a HTTP/HTTPS client using the specified pool options- Parameters:
poolOptions- the pool options to use- Returns:
- the client
-
createHttpClient
Create a HTTP/HTTPS client using default options- Returns:
- the client
-
createDatagramSocket
Create a datagram socket using the specified options- Parameters:
options- the options to use- Returns:
- the socket
-
createDatagramSocket
Create a datagram socket using default options- Returns:
- the socket
-
fileSystem
Get the filesystem object. There is a single instance of FileSystem per Vertx instance.- Returns:
- the filesystem object
-
eventBus
Get the event bus object. There is a single instance of EventBus per Vertx instance.- Returns:
- the event bus object
-
createDnsClient
Create a DNS client to connect to a DNS server at the specified host and port, with the default query timeout (5 seconds)- Parameters:
port- the porthost- the host- Returns:
- the DNS client
-
createDnsClient
Create a DNS client to connect to the DNS server configured byVertxOptions.getAddressResolverOptions()DNS client takes the first configured resolver address provided by
DnsAddressResolverProvider#nameServerAddresses()}- Returns:
- the DNS client
-
createDnsClient
Create a DNS client to connect to a DNS server- Parameters:
options- the client options- Returns:
- the DNS client
-
timer
Liketimer(long, TimeUnit)with a unit in millis. -
timer
Create a timer task configured with the specifieddelay, when the timeout fires the timer future is succeeded, when the timeout is cancelled the timer future is failed with aCancellationExceptioninstance.- Parameters:
delay- the delayunit- the delay unit- Returns:
- the timer object
-
setTimer
Set a one-shot timer to fire afterdelaymilliseconds, at which pointhandlerwill be called with the id of the timer.- Parameters:
delay- the delay in milliseconds, after which the timer will firehandler- the handler that will be called with the timer ID when the timer fires- Returns:
- the unique ID of the timer
-
setPeriodic
Set a periodic timer to fire everydelaymilliseconds, at which pointhandlerwill be called with the id of the timer.- Parameters:
delay- the delay in milliseconds, after which the timer will firehandler- the handler that will be called with the timer ID when the timer fires- Returns:
- the unique ID of the timer
-
setPeriodic
Set a periodic timer to fire everydelaymilliseconds with initial delay, at which pointhandlerwill be called with the id of the timer.- Parameters:
initialDelay- the initial delay in millisecondsdelay- the delay in milliseconds, after which the timer will firehandler- the handler that will be called with the timer ID when the timer fires- Returns:
- the unique ID of the timer
-
cancelTimer
public boolean cancelTimer(long id) Cancels the timer with the specifiedid.- Parameters:
id- The id of the timer to cancel- Returns:
- true if the timer was successfully cancelled, or false if the timer does not exist.
-
runOnContext
Puts the handler on the event queue for the current context so it will be run asynchronously ASAP after all preceeding events have been handled.- Parameters:
action- - a handler representing the action to execute
-
deploymentIDs
Return a Set of deployment IDs for the currently deployed deploymentIDs.- Returns:
- Set of deployment IDs
-
registerVerticleFactory
public void registerVerticleFactory(io.vertx.core.spi.VerticleFactory factory) Register aVerticleFactorythat can be used for deploying Verticles based on an identifier.- Parameters:
factory- the factory to register
-
unregisterVerticleFactory
public void unregisterVerticleFactory(io.vertx.core.spi.VerticleFactory factory) Unregister aVerticleFactory- Parameters:
factory- the factory to unregister
-
verticleFactories
Return the Set of currently registered verticle factories.- Returns:
- the set of verticle factories
-
isClustered
public boolean isClustered()Is this Vert.x instance clustered?- Returns:
- true if clustered
-
isNativeTransportEnabled
public boolean isNativeTransportEnabled()- Returns:
- whether the native transport is used
-
exceptionHandler
Set a default exception handler forContext, set onContext#exceptionHandler(Handler)at creation.- Parameters:
handler- the exception handler. Can benull.- Returns:
- a reference to this, so the API can be used fluently
-
isMetricsEnabled
public boolean isMetricsEnabled()Whether the metrics are enabled for this measured object- Specified by:
isMetricsEnabledin interfaceMeasured- Returns:
trueif metrics are enabled
-
newInstance
Creates a new instance of theVertx. -
hashCode
public int hashCode() -
equals
-
toString
-