### Configure and Start Vert.x Shell Server
Source: https://vertx.io/docs/vertx-shell/java
This snippet demonstrates the programmatic setup of a Vert.x Shell Server, including creating the server, configuring HTTP and SSH term servers, registering base commands, and starting the server.
```java
ShellServer server = ShellServer.create(vertx);
Router shellRouter = Router.router(vertx);
router.route("/shell/*").subRouter(shellRouter);
TermServer httpTermServer = TermServer.createHttpTermServer(vertx, router);
TermServer sshTermServer = TermServer.createSSHTermServer(vertx);
server.registerTermServer(httpTermServer);
server.registerTermServer(sshTermServer);
server.registerCommandResolver(CommandResolver.baseCommands(vertx));
server.listen();
```
--------------------------------
### Origin Server (Backend) Setup
Source: https://vertx.io/docs/5.1.2/vertx-web-proxy/java
Creates an origin server that listens on port 7070 and handles GET requests to /foo.
```java
HttpServer backendServer = vertx.createHttpServer();
Router backendRouter = Router.router(vertx);
backendRouter.route(HttpMethod.GET, "/foo").handler(rc -> {
rc.response()
.putHeader("content-type", "text/html")
.end("
I'm the target resource!
");
});
backendServer.requestHandler(backendRouter).listen(7070);
```
--------------------------------
### Create and Configure Vert.x Shell Server
Source: https://vertx.io/docs/5.1.2/vertx-shell/java
This snippet demonstrates the basic setup of a Vert.x Shell Server, including creating the server, an HTTP term server mounted on an existing router, an SSH term server, registering them, and finally starting the server.
```java
ShellServer server = ShellServer.create(vertx);
Router shellRouter = Router.router(vertx);
router.route("/shell/*").subRouter(shellRouter);
TermServer httpTermServer = TermServer.createHttpTermServer(vertx, router);
TermServer sshTermServer = TermServer.createSSHTermServer(vertx);
server.registerTermServer(httpTermServer);
server.registerTermServer(sshTermServer);
server.registerCommandResolver(CommandResolver.baseCommands(vertx));
server.listen();
```
--------------------------------
### start
Source: https://vertx.io/docs/5.1.2/apidocs/io/vertx/core/class-use/Future.html
Start the rabbitMQ client.
```APIDOC
## start
### Description
Start the rabbitMQ client.
### Method
`start()`
### Return Type
`Future`
```
--------------------------------
### start
Source: https://vertx.io/docs/apidocs/io/vertx/reactivex/rabbitmq/RabbitMQPublisher.html
Starts the RabbitMQ publisher.
```APIDOC
## start
### Description
Start the rabbitMQ publisher.
### Method
start
### Returns
A Future that completes when the publisher has started.
```
--------------------------------
### io.vertx.spi.cluster.ignite.IgniteOptions.getDelayAfterStart
Source: https://vertx.io/docs/apidocs/index-all.html
Get the delay after start.
```APIDOC
## getDelayAfterStart()
### Description
Get the delay after start.
### Method
N/A (Instance method)
### Endpoint
N/A
### Parameters
None
### Request Example
N/A
### Response
#### Success Response
- **long**: The delay in milliseconds.
```
--------------------------------
### Application Startup Logs
Source: https://vertx.io/docs/howtos/hibernate-reactive-howto
Example log output when starting the Hibernate Reactive application. This includes PostgreSQL container startup and Vert.x server initialization.
```log
[INFO] --- exec-maven-plugin:3.0.0:java (default-cli) @ hibernate-reactive-howto ---
2021-05-18 13:54:35,570 INFO [io.vertx.howtos.hr.MainVerticle.main()] io.vertx.howtos.hr.MainVerticle - 🚀 Starting a PostgreSQL container
2021-05-18 13:54:39,430 DEBUG [io.vertx.howtos.hr.MainVerticle.main()] 🐳 [postgres:11-alpine] - Starting container: postgres:11-alpine
2021-05-18 13:54:39,431 DEBUG [io.vertx.howtos.hr.MainVerticle.main()] 🐳 [postgres:11-alpine] - Trying to start container: postgres:11-alpine (attempt 1/1)
2021-05-18 13:54:39,432 DEBUG [io.vertx.howtos.hr.MainVerticle.main()] 🐳 [postgres:11-alpine] - Starting container: postgres:11-alpine
2021-05-18 13:54:39,432 INFO [io.vertx.howtos.hr.MainVerticle.main()] 🐳 [postgres:11-alpine] - Creating container for image: postgres:11-alpine
2021-05-18 13:54:40,016 INFO [io.vertx.howtos.hr.MainVerticle.main()] 🐳 [postgres:11-alpine] - Starting container with ID: f538f59149d72ebec87382b09624240ca2faddcbc9c247a53575a537d1d7f045
2021-05-18 13:54:42,050 INFO [io.vertx.howtos.hr.MainVerticle.main()] 🐳 [postgres:11-alpine] - Container postgres:11-alpine is starting: f538f59149d72ebec87382b09624240ca2faddcbc9c247a53575a537d1d7f045
2021-05-18 13:54:43,918 INFO [io.vertx.howtos.hr.MainVerticle.main()] 🐳 [postgres:11-alpine] - Container postgres:11-alpine started in PT4.510869S
2021-05-18 13:54:43,918 INFO [io.vertx.howtos.hr.MainVerticle.main()] io.vertx.howtos.hr.MainVerticle - 🚀 Starting Vert.x
2021-05-18 13:54:44,342 INFO [vert.x-worker-thread-0] org.hibernate.jpa.internal.util.LogHelper - HHH000204: Processing PersistenceUnitInfo [name: pg-demo]
2021-05-18 13:54:44,408 INFO [vert.x-worker-thread-0] org.hibernate.Version - HHH000412: Hibernate ORM core version 5.4.31.Final
2021-05-18 13:54:44,581 INFO [vert.x-eventloop-thread-0] io.vertx.howtos.hr.MainVerticle - ✅ HTTP server listening on port 8080
2021-05-18 13:54:44,586 INFO [vert.x-worker-thread-0] org.hibernate.annotations.common.Version - HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2021-05-18 13:54:44,775 INFO [vert.x-worker-thread-0] org.hibernate.dialect.Dialect - HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL10Dialect
2021-05-18 13:54:45,006 INFO [vert.x-worker-thread-0] o.h.reactive.provider.impl.ReactiveIntegrator - HRX000001: Hibernate Reactive Preview
2021-05-18 13:54:45,338 INFO [vert.x-worker-thread-0] o.h.reactive.pool.impl.DefaultSqlClientPool - HRX000011: SQL Client URL [jdbc:postgresql://localhost:55019/postgres]
2021-05-18 13:54:45,342 WARN [vert.x-eventloop-thread-0] io.vertx.core.impl.VertxImpl - You're already on a Vert.x context, are you sure you want to create a new Vertx instance?
2021-05-18 13:54:45,345 INFO [vert.x-worker-thread-0] o.h.reactive.pool.impl.DefaultSqlClientPool - HRX000012: Connection pool size: 10
[Hibernate]
drop table if exists Product cascade
2021-05-18 13:54:45,521 WARN [vert.x-eventloop-thread-0] io.vertx.sqlclient.impl.SocketConnectionBase - Backend notice: severity='NOTICE', code='00000', message='table "product" does not exist, skipping', detail='null', hint='null', position='null', internalPosition='null', internalQuery='null', where='null', file='tablecmds.c', line='1060', routine='DropErrorMsgNonExistent', schema='null', table='null', column='null', dataType='null', constraint='null'
[Hibernate]
drop sequence if exists hibernate_sequence
2021-05-18 13:54:45,527 WARN [vert.x-eventloop-thread-0] io.vertx.sqlclient.impl.SocketConnectionBase - Backend notice: severity='NOTICE', code='00000', message='sequence "hibernate_sequence" does not exist, skipping', detail='null', hint='null', position='null', internalPosition='null', internalQuery='null', where='null', file='tablecmds.c', line='1060', routine='DropErrorMsgNonExistent', schema='null', table='null', column='null', dataType='null', constraint='null'
[Hibernate]
drop table if exists Product cascade
2021-05-18 13:54:45,537 WARN [vert.x-eventloop-thread-0] io.vertx.sqlclient.impl.SocketConnectionBase - Backend notice: severity='NOTICE', code='00000', message='table "product" does not exist, skipping', detail='null', hint='null', position='null', internalPosition='null', internalQuery='null', where='null', file='tablecmds.c', line='1060', routine='DropErrorMsgNonExistent', schema='null', table='null', column='null', dataType='null', constraint='null'
[Hibernate]
drop sequence if exists hibernate_sequence
```
--------------------------------
### start()
Source: https://vertx.io/docs/5.1.2/apidocs/io/vertx/ext/shell/ShellService.html
Starts the shell service asynchronously.
```APIDOC
## start()
### Description
Start the shell service, this is an asynchronous start.
### Method
Future
### Returns
A Future that completes when the service has been started.
```
--------------------------------
### start
Source: https://vertx.io/docs/5.1.2/apidocs/io/vertx/lang/groovy/ScriptVerticle.html
Starts the verticle instance. Vert.x calls this method when deploying the instance.
```APIDOC
## start
### Description
Starts the verticle instance. This method is invoked by Vert.x during deployment. The implementation should complete or fail the provided `Promise` upon completion of the startup process.
### Method
`public void start(Promise startPromise)`
### Parameters
* **startPromise** (Promise) - The promise to be completed or failed once the verticle has started.
### Throws
* `Exception` - If an error occurs during startup.
```
--------------------------------
### Start MqttServer
Source: https://vertx.io/docs/5.1.2/apidocs/io/vertx/mqtt/class-use/MqttServer.html
Methods to start the MQTT server listening for incoming connections.
```APIDOC
## listen()
### Description
Start the server listening for incoming connections using the specified options through the constructor.
### Method
Future
### Response
* **Future** - A Future that will be completed with the MqttServer instance when it starts listening.
```
```APIDOC
## listen(int port)
### Description
Start the server listening for incoming connections on the specified port but on "0.0.0.0" as host.
### Method
Future
### Parameters
* **port** (int) - The port to listen on.
### Response
* **Future** - A Future that will be completed with the MqttServer instance when it starts listening.
```
```APIDOC
## listen(int port, String host)
### Description
Start the server listening for incoming connections on the specified port and host.
### Method
Future
### Parameters
* **port** (int) - The port to listen on.
* **host** (String) - The host to listen on.
### Response
* **Future** - A Future that will be completed with the MqttServer instance when it starts listening.
```
--------------------------------
### Running HTTPServer with GraalVM Native Image
Source: https://vertx.io/docs/howtos/graal-native-image-howto
Launch an HTTPServer using a GraalVM native image. This example shows how to start a basic HTTP server and includes Netty's channel ID warning and Vert.x deployment success messages.
```bash
./target/hello_native run vertx.HTTPServer
Dec 02, 2020 7:51:56 PM io.netty.channel.DefaultChannelId defaultProcessId
WARNING: Failed to find the current process ID from ''; using a random value: 1891971538
Dec 02, 2020 7:51:56 PM io.vertx.core.impl.launcher.commands.VertxIsolatedDeployer
INFO: Succeeded in deploying verticle
Server listening on http://localhost:8080/
^C
```
--------------------------------
### setUp
Source: https://vertx.io/docs/apidocs/index-all.html
Sets up the command execution environment.
```APIDOC
## setUp(ExecutionContext)
### Description
Set up the command execution environment.
### Method
Not specified (likely a setter method).
### Endpoint
N/A
### Parameters
#### Path Parameters
N/A
#### Query Parameters
N/A
#### Request Body
N/A
### Request Example
N/A
### Response
#### Success Response (200)
N/A
#### Response Example
N/A
```
--------------------------------
### setupBackend
Source: https://vertx.io/docs/apidocs/index-all.html
Creates a new backend registry with a micrometer registry, initialized with provided options.
```APIDOC
## setupBackend(MicrometerMetricsOptions, MeterRegistry)
### Description
Create a new backend registry, containing a micrometer registry, initialized with the provided options.
### Method
Static method.
### Endpoint
N/A
### Parameters
#### Path Parameters
N/A
#### Query Parameters
N/A
#### Request Body
N/A
### Request Example
N/A
### Response
#### Success Response (200)
N/A
#### Response Example
N/A
```
--------------------------------
### Verticle with HTTP Server
Source: https://vertx.io/docs/5.1.2/vertx-core/java
An example of a Verticle that starts an HTTP server. The start method is overridden to create and configure the server.
```java
class MyVerticle extends VerticleBase {
private HttpServer server;
@Override
public Future> start() {
server = vertx.createHttpServer().requestHandler(req -> {
req.response()
.putHeader("content-type", "text/plain")
.end("Hello from Vert.x!");
});
```
--------------------------------
### rxStart
Source: https://vertx.io/docs/apidocs/io/vertx/rxjava3/rabbitmq/RabbitMQPublisher.html
RxJava3 version of the start method. Starts the RabbitMQ publisher asynchronously.
```APIDOC
## Completable rxStart
### Description
Start the rabbitMQ publisher.
### Method
Instance
### Returns
* Completable - A Completable that completes when the publisher has started.
```
--------------------------------
### Start Listening
Source: https://vertx.io/docs/5.1.2/apidocs/io/vertx/core/net/class-use/NetServer.html
Methods for starting the server to listen on a specified port and host.
```APIDOC
## Start Listening
### Description
Methods for starting the server to listen on a specified port and host.
### Methods
- `Future NetServer.listen()`: Start listening on the port and host as configured in the `NetServerOptions`.
- `Future NetServer.listen(int port)`: Start listening on the specified port and host "0.0.0.0".
- `Future NetServer.listen(int port, String host)`: Start listening on the specified port and host.
- `Future NetServer.listen(SocketAddress localAddress)`: Start listening on the specified local address.
```
--------------------------------
### IgniteOptions.getDefaultRegionInitialSize()
Source: https://vertx.io/docs/5.1.2/apidocs/index-all.html
Get default data region start size.
```APIDOC
## getDefaultRegionInitialSize()
### Description
Get default data region start size.
### Method
Method
### Endpoint
N/A
### Parameters
N/A
### Request Example
N/A
### Response
#### Success Response
- **size** (int) - The default data region start size.
```
--------------------------------
### rxStart
Source: https://vertx.io/docs/apidocs/index-all.html
Override to return a `Completable` that will complete the deployment of this verticle. Also used to start the RabbitMQ client and publisher.
```APIDOC
## rxStart()
### Description
Override to return a `Completable` that will complete the deployment of this verticle. Also used to start the RabbitMQ client and publisher.
### Method
Not specified (likely part of an SDK call)
### Endpoint
Not applicable (SDK method)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
```java
// Example for io.vertx.reactivex.core.AbstractVerticle, io.vertx.reactivex.rabbitmq.RabbitMQClient, or io.vertx.reactivex.rabbitmq.RabbitMQPublisher
verticle.rxStart()
// or
rabbitMQClient.rxStart()
// or
rabbitMQPublisher.rxStart()
```
### Response
#### Success Response (200)
Type not specified, likely a `Completable` that completes upon successful start.
#### Response Example
```json
{
"example": "Completable"
}
```
```
--------------------------------
### Complete CircuitBreakerVerticle Start Method
Source: https://vertx.io/docs/howtos/resilience4j-howto
The full implementation of the start method, combining circuit breaker creation, server setup, and request handling.
```java
@Override
public Future> start() {
CircuitBreaker cb = CircuitBreaker.of("my-circuit-breaker", CircuitBreakerConfig.custom()
.minimumNumberOfCalls(5)
.build());
Router router = Router.router(vertx);
WebClient client = WebClient.create(vertx);
router.get("/").handler(ctx -> {
VertxCircuitBreaker.executeFuture(cb, () -> {
return client.get(8080, "localhost", "/does-not-exist")
.as(BodyCodec.string())
.send()
.expecting(HttpResponseExpectation.SC_SUCCESS);
})
.onSuccess(response -> ctx.end("Got: " + response.body() + "\n"))
.onFailure(error -> ctx.end("Failed with: " + error.toString() + "\n"));
});
return vertx.createHttpServer()
.requestHandler(router)
.listen(8080)
.onSuccess(server -> {
System.out.println("HTTP server started on port " + server.actualPort());
});
}
```
--------------------------------
### Starting the HttpServer
Source: https://vertx.io/docs/5.1.2/apidocs/io/vertx/reactivex/core/http/class-use/HttpServer.html
Illustrates how to start the HttpServer listening on a specified port and host, with both synchronous and reactive approaches.
```APIDOC
## Starting the HttpServer
### Description
Methods to initiate the HttpServer to start listening for incoming connections, with options for specifying port, host, and using reactive types.
### Methods
- **`HttpServer.listen()`**: Starts the server listening using default configuration.
- **`HttpServer.listen(int port)`**: Starts the server listening on the specified port on host "0.0.0.0".
- **`HttpServer.listen(int port, String host)`**: Starts the server listening on the specified port and host.
- **`HttpServer.listen(SocketAddress address)`**: Starts the server listening on the given socket address.
- **`HttpServer.rxListen()`**: Returns a `Single` that completes when the server starts listening.
- **`HttpServer.rxListen(int port)`**: Returns a `Single` for listening on a specific port.
- **`HttpServer.rxListen(int port, String host)`**: Returns a `Single` for listening on a specific port and host.
- **`HttpServer.rxListen(SocketAddress address)`**: Returns a `Single` for listening on a specific socket address.
```
--------------------------------
### Configure and Start HTTP Server
Source: https://vertx.io/docs/howtos/web-and-openapi-howto
Instantiates an HTTP server with specified port and host, then mounts the router to handle incoming requests and starts listening.
```java
server = vertx.createHttpServer(new HttpServerOptions().setPort(8080).setHost("localhost"));
server.requestHandler(router).listen();
```
--------------------------------
### Shorthand Route Matching for GET Requests
Source: https://vertx.io/docs/5.1.2/vertx-web/java
Use shorthand methods like `router.get()` for common HTTP methods. This example shows a handler for any GET request.
```java
router.get().handler(ctx -> {
// Will be called for any GET request
});
```
--------------------------------
### RabbitMQPublisher rxStart
Source: https://vertx.io/docs/5.1.2/apidocs/io/vertx/rxjava3/rabbitmq/RabbitMQPublisher.html
Start the rabbitMQ publisher. The RabbitMQClient should have been started before this.
```APIDOC
## RabbitMQPublisher rxStart
### Description
Start the rabbitMQ publisher. The RabbitMQClient should have been started before this.
### Method
Completable rxStart()
### Returns
```
--------------------------------
### Docker Container Output Example
Source: https://vertx.io/docs/howtos/executable-jar-docker-howto
Example console output from a running Vert.x application inside a Docker container, indicating the HTTP server has started and the verticle has been deployed.
```text
HTTP server started on port 8888
Dec 02, 2024 5:17:19 PM io.vertx.launcher.application.VertxApplication
INFO: Succeeded in deploying verticle
```
--------------------------------
### rxStart
Source: https://vertx.io/docs/5.1.2/apidocs/index-all.html
Start the rabbitMQ publisher.
```APIDOC
## rxStart()
### Description
Start the rabbitMQ publisher.
### Method
Not specified (assumed to be part of a reactive client)
### Endpoint
Not applicable (SDK method)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
None
### Response
#### Success Response
Not specified
#### Response Example
None
```
--------------------------------
### rxStart
Source: https://vertx.io/docs/5.1.2/apidocs/io/vertx/reactivex/rabbitmq/RabbitMQClient.html
Starts the RabbitMQ client.
```APIDOC
## rxStart
### Description
Start the rabbitMQ client.
```
--------------------------------
### RxJava Verticle with Asynchronous Start
Source: https://vertx.io/docs/5.1.2/vertx-rx/java3
Illustrates how a Verticle can perform an asynchronous start using the `rxStart` method, returning a `Completable`. This example creates an HTTP server and listens on a port.
```java
class MyVerticle extends AbstractVerticle {
public Completable rxStart() {
return vertx.createHttpServer()
.requestHandler(req -> req.response().end("Hello World"))
.rxListen()
.ignoreElement();
}
}
```
--------------------------------
### Shorthand Route Matching for GET Requests with Path
Source: https://vertx.io/docs/5.1.2/vertx-web/java
Combine shorthand methods with path matching using `router.get("/some/path/")`. This handler is invoked for GET requests to paths starting with `/some/path`.
```java
router.get("/some/path/").handler(ctx -> {
// Will be called for any GET request to a path
// starting with /some/path
});
```
--------------------------------
### setupBackend(MicrometerMetricsOptions, MeterRegistry)
Source: https://vertx.io/docs/5.1.2/apidocs/index-all.html
Create a new backend registry with a micrometer registry, initialized with the provided options.
```APIDOC
## setupBackend(MicrometerMetricsOptions, MeterRegistry)
### Description
Create a new backend registry with a micrometer registry, initialized with the provided options.
### Method
Static method
### Endpoint
Not applicable (Java method signature)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
None
### Response
#### Success Response
None
#### Response Example
None
```
--------------------------------
### GraphiQLHandler.create(Vertx)
Source: https://vertx.io/docs/5.1.2/apidocs/io/vertx/ext/web/handler/graphql/GraphiQLHandler.html
Creates a new GraphiQLHandler with default options. This is a convenient way to get started with GraphiQL.
```APIDOC
## GraphiQLHandler.create(Vertx)
### Description
Create a new `GraphiQLHandler`.
The handler will be configured with default `options`.
### Method Signature
`static GraphiQLHandler create(Vertx vertx)`
```
--------------------------------
### Handling MQTT Client Connection
Source: https://vertx.io/docs/vertx-mqtt/java
This example demonstrates how to create an MQTT server, handle incoming client connections, and accept them. It logs connection details and properties.
```java
MqttServer mqttServer = MqttServer.create(vertx);
mqttServer.endpointHandler(endpoint -> {
// shows main connect info
System.out.println("MQTT client [" + endpoint.clientIdentifier() + "] request to connect, clean session = " + endpoint.isCleanSession());
if (endpoint.auth() != null) {
System.out.println("[username = " + endpoint.auth().getUsername() + ", password = " + endpoint.auth().getPassword() + "]");
}
System.out.println("[properties = " + endpoint.connectProperties() + "]");
if (endpoint.will() != null) {
System.out.println("[will topic = " + endpoint.will().getWillTopic() + " msg = " + new String(endpoint.will().getWillMessageBytes()) +
" QoS = " + endpoint.will().getWillQos() + " isRetain = " + endpoint.will().isWillRetain() + "]");
}
System.out.println("[keep alive timeout = " + endpoint.keepAliveTimeSeconds() + "]");
// accept connection from the remote client
endpoint.accept(false);
})
.listen()
.onComplete(ar -> {
if (ar.succeeded()) {
System.out.println("MQTT server is listening on port " + ar.result().actualPort());
} else {
System.out.println("Error on starting the server");
ar.cause().printStackTrace();
}
});
```
--------------------------------
### Vertx.createDatagramSocket()
Source: https://vertx.io/docs/5.1.2/apidocs/io/vertx/core/datagram/class-use/DatagramSocket.html
Creates a datagram socket using the default options. This is a convenient way to get started with datagram communication.
```APIDOC
## Vertx.createDatagramSocket()
### Description
Creates a datagram socket using default options.
### Method
`default DatagramSocket`
### Returns
A new `DatagramSocket` instance.
```
--------------------------------
### Accessing Request Headers
Source: https://vertx.io/docs/5.1.2/vertx-core/java
Retrieve specific headers from an HTTP request. The example shows how to get the 'User-Agent' header.
```java
System.out.println("User agent is " + headers.get("User-Agent"));
```
--------------------------------
### init
Source: https://vertx.io/docs/5.1.2/apidocs/io/vertx/servicediscovery/backend/redis/RedisBackendService.html
Initializes the backend with the Vert.x instance and configuration.
```APIDOC
## init(Vertx vertx, JsonObject configuration)
### Description
Initializes the backend.
### Method
`init`
### Parameters
#### Path Parameters
- **vertx** (Vertx) - the vert.x instance
- **configuration** (JsonObject) - the configuration if any.
### Response
#### Success Response (void)
This method does not return a value.
```
--------------------------------
### BackendRegistries.setupBackend
Source: https://vertx.io/docs/5.1.2/apidocs/io/vertx/micrometer/class-use/MicrometerMetricsOptions.html
Sets up a backend registry with Micrometer options.
```APIDOC
## BackendRegistries.setupBackend
### Method Signature
- `static BackendRegistry setupBackend(MicrometerMetricsOptions options, io.micrometer.core.instrument.MeterRegistry meterRegistry)`: Create a new backend registry, containing a micrometer registry, initialized with the provided options.
```
--------------------------------
### Server Instantiation
Source: https://vertx.io/docs/apidocs/io/vertx/rxjava3/openapi/contract/class-use/Server.html
Demonstrates how to create a new instance of the Server class.
```APIDOC
## Server newInstance
### Description
Creates a new instance of the Server class.
### Method
`static Server`
### Parameters
#### Path Parameters
- `arg` (Server) - Required - The server instance to use for creating the new instance.
```
--------------------------------
### Get Kubernetes Pods
Source: https://vertx.io/docs/howtos/k8s-client-side-lb-howto
Retrieves a list of pods associated with a specific deployment. This is useful for verifying that pods have started successfully.
```bash
kubectl get pods --selector=app=hello-node
```
--------------------------------
### Create GraphiQLHandler with default options
Source: https://vertx.io/docs/apidocs/io/vertx/reactivex/ext/web/handler/graphql/GraphiQLHandler.html
Creates a new GraphiQLHandler with default GraphiQLHandlerOptions. This is a convenient way to get started with GraphiQL.
```APIDOC
## static GraphiQLHandler create(Vertx vertx)
### Description
Create a new `GraphiQLHandler`.
The handler will be configured with default `GraphiQLHandlerOptions`.
### Method
static
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Response
#### Success Response
- `GraphiQLHandler` - The created GraphiQLHandler instance.
### Response Example
```json
{
"example": "GraphiQLHandler instance"
}
```
```
--------------------------------
### rxListen (no args)
Source: https://vertx.io/docs/5.1.2/apidocs/io/vertx/reactivex/core/net/QuicServer.html
Starts listening on the port and host configured in the `QuicServerConfig` used when creating the server, returning a RxJava Single.
```APIDOC
## rxListen
### Description
Starts listening on the configured port and host using RxJava.
### Method
public Single rxListen()
### Returns
- a future signaling the success or failure of the listen operation, the result is socket address this endpoint is bound to
```
--------------------------------
### MqttServer.create (with options)
Source: https://vertx.io/docs/apidocs/io/vertx/reactivex/core/class-use/Vertx.html
Return an MQTT server instance.
```APIDOC
## MqttServer.create (with options)
### Description
Return an MQTT server instance.
### Method
static
### Signature
MqttServer.create(Vertx vertx, MqttServerOptions options)
### Parameters
#### Path Parameters
- **vertx** (Vertx) - The Vertx instance.
- **options** (MqttServerOptions) - The MQTT server options.
### Response
#### Success Response
- **MqttServer** - An instance of MqttServer.
```
--------------------------------
### Create HandlebarsTemplateEngine with Defaults
Source: https://vertx.io/docs/apidocs/io/vertx/ext/web/templ/handlebars/HandlebarsTemplateEngine.html
Creates a new HandlebarsTemplateEngine with default configurations. This is the simplest way to get started with Handlebars templating.
```APIDOC
## create
### Description
Creates a new HandlebarsTemplateEngine using default settings.
### Method
static
### Signature
create(Vertx vertx)
### Parameters
* **vertx** (Vertx) - The Vertx instance to use.
### Returns
HandlebarsTemplateEngine - A new instance of the engine.
```
--------------------------------
### Create React App
Source: https://vertx.io/docs/howtos/single-page-react-vertx-howto
Initializes a new React frontend project using create-react-app.
```bash
cd src/main
npx create-react-app frontend
```
--------------------------------
### create(Vertx, String, String)
Source: https://vertx.io/docs/5.1.2/apidocs/io/vertx/ext/auth/oauth2/providers/GitLabAuth.html
Creates an OAuth2Auth provider for GitLab.com. This is the simplest way to get started with GitLab authentication.
```APIDOC
## create(Vertx, String, String)
### Description
Creates an OAuth2Auth provider for GitLab.com.
### Method
Static Method
### Parameters
* **vertx** (Vertx) - The Vert.x instance.
* **clientId** (String) - The client ID provided by GitLab.
* **clientSecret** (String) - The client secret provided by GitLab.
### Returns
* OAuth2Auth - An OAuth2Auth provider instance for GitLab.com.
```
--------------------------------
### Create NetServer with Options
Source: https://vertx.io/docs/apidocs/io/vertx/core/net/class-use/NetServerOptions.html
Demonstrates how to create a TCP/SSL server using NetServerOptions.
```APIDOC
## Vertx.createNetServer(NetServerOptions options)
### Description
Create a TCP/SSL server using the specified options.
### Method
`createNetServer`
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
```java
NetServerOptions options = new NetServerOptions()
.setPort(8080)
.setHost("localhost");
NetServer server = vertx.createNetServer(options);
```
### Response
#### Success Response (200)
`NetServer` instance
#### Response Example
```java
// Server is created and ready to accept connections
```
```
--------------------------------
### Build Vert.x with Options and Metrics
Source: https://vertx.io/docs/5.1.2/apidocs/io/vertx/core/VertxBuilder.html
Example of creating a Vert.x instance with custom options and a metrics factory.
```java
Vertx vertx = Vertx.builder().with(options).withMetrics(metricsFactory).build();
```
--------------------------------
### Specific Path Failure Handler
Source: https://vertx.io/docs/5.1.2/vertx-web/java
Sets a failure handler that is only invoked for failures occurring on GET requests to paths starting with '/somepath/'.
```java
Route route = router.get("/somepath/*");
route.failureHandler(ctx -> {
// This will be called for failures that occur
// when routing requests to paths starting with
// '/somepath/'
});
```
--------------------------------
### Create PebbleTemplateEngine with defaults
Source: https://vertx.io/docs/5.1.2/apidocs/io/vertx/ext/web/templ/pebble/PebbleTemplateEngine.html
Creates a new PebbleTemplateEngine instance using default configurations. This is the simplest way to get started with the engine.
```APIDOC
## create
### Description
Create a template engine using defaults.
### Method
static PebbleTemplateEngine
### Parameters
#### Path Parameters
* **vertx** (Vertx) - The Vert.x instance.
### Returns
* **PebbleTemplateEngine** - The created template engine.
```
--------------------------------
### rxListen (no args)
Source: https://vertx.io/docs/5.1.2/apidocs/io/vertx/reactivex/mqtt/MqttServer.html
Starts the MQTT server listening for incoming connections. This method uses default host and port configurations.
```APIDOC
## rxListen
### Description
Starts the server listening for incoming connections using the specified options through the constructor.
### Method
`public Single rxListen()`
### Returns
a `Single` completed with this server instance.
```
--------------------------------
### Run Infinispan Server with Docker
Source: https://vertx.io/docs/howtos/web-session-infinispan-howto
Starts an Infinispan server instance locally using Docker. Ensure you have Docker installed and running.
```bash
docker run -p 11222:11222 -e USER="admin" -e PASS="bar" infinispan/server:14.0
```
--------------------------------
### rxStart() - AbstractVerticle
Source: https://vertx.io/docs/5.1.2/apidocs/index-all.html
Override to return a `Completable` that will complete the deployment of this verticle.
```APIDOC
## rxStart()
### Description
Override to return a `Completable` that will complete the deployment of this verticle.
### Method
N/A (Method Signature)
### Endpoint
N/A
### Parameters
N/A
### Request Example
N/A
### Response
N/A
### Response Example
N/A
```
--------------------------------
### Setup Callback for Credential Get (Assertion)
Source: https://vertx.io/docs/apidocs/io/vertx/ext/web/handler/WebAuthn4JHandler.html
Configures the callback route for creating login attestations. This is used when a user logs in with an existing authenticator.
```APIDOC
## setupCredentialsGetCallback
```java
WebAuthn4JHandler setupCredentialsGetCallback(Route route)
```
### Description
The callback route to create login attestations. Usually this route is ```
/webauthn/login
```
### Parameters
#### Path Parameters
- **route** (Route) - the route where credential get options are generated.
### Returns
fluent self.
```
--------------------------------
### Load KeyStore from File
Source: https://vertx.io/docs/5.1.2/apidocs/io/vertx/core/net/KeyStoreOptions.html
Configure KeyStoreOptions by providing the path to the keystore file and its password. Use this when the keystore is accessible on the filesystem.
```java
HttpServerOptions options = HttpServerOptions.httpServerOptions();
options.setKeyCertOptions(new KeyStoreOptions().setType("JKS").setPath("/mykeystore.jks").setPassword("foo"));
```
--------------------------------
### rxStart
Source: https://vertx.io/docs/5.1.2/apidocs/index-all.html
Override to return a `Completable` that will complete the deployment of this verticle.
```APIDOC
## rxStart()
### Description
Override to return a `Completable` that will complete the deployment of this verticle.
### Method
Not specified (assumed to be part of a reactive client)
### Endpoint
Not applicable (SDK method)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
None
### Response
#### Success Response
Not specified
#### Response Example
None
```
--------------------------------
### Create StaticHandler with Defaults
Source: https://vertx.io/docs/5.1.2/apidocs/io/vertx/reactivex/ext/web/handler/StaticHandler.html
Creates a StaticHandler instance using default configuration values. This is the simplest way to get started with serving static files.
```APIDOC
## StaticHandler.create()
### Description
Creates a handler using defaults.
### Method
static StaticHandler
### Endpoint
N/A (This is a factory method for creating a handler)
### Parameters
None
### Response
- **StaticHandler**: A new instance of StaticHandler with default settings.
```
--------------------------------
### Create GrpcIoClient with Vertx
Source: https://vertx.io/docs/5.1.2/apidocs/io/vertx/grpcio/client/GrpcIoClient.html
Creates a gRPC client instance using the provided Vert.x instance. This is a basic way to get started with the gRPC client.
```java
static GrpcIoClient client(Vertx vertx)
```
--------------------------------
### Create PebbleTemplateEngine with Defaults
Source: https://vertx.io/docs/5.1.2/apidocs/io/vertx/ext/web/templ/pebble/class-use/PebbleTemplateEngine.html
Creates a new PebbleTemplateEngine instance using default configurations. This is the simplest way to get started with Pebble templating in Vert.x.
```APIDOC
## create(Vertx vertx)
### Description
Create a template engine using defaults.
### Method
`static PebbleTemplateEngine`
### Parameters
* **vertx** (Vertx) - The Vert.x instance.
### Returns
* **PebbleTemplateEngine** - A new instance of PebbleTemplateEngine.
```
--------------------------------
### Start Server Listening (Default Options)
Source: https://vertx.io/docs/5.1.2/vertx-core/java
Starts the QUIC server listening for incoming requests using the host and port specified in its configuration options.
```APIDOC
## Start Server Listening (Default Options)
### Description
Starts the QUIC server listening for incoming requests using the host and port specified in its configuration options. The actual bind is asynchronous.
### Method
`server.listen()`
### Parameters
None
### Request Example
```java
QuicServer server = vertx.createQuicServer(sslOptions);
server.listen();
```
### Response
#### Success Response
The server starts listening. Use `onComplete` handler for notification.
#### Response Example
```java
// Server starts listening asynchronously
```
```
--------------------------------
### rxStart() - RabbitMQPublisher
Source: https://vertx.io/docs/5.1.2/apidocs/index-all.html
Start the rabbitMQ publisher.
```APIDOC
## rxStart()
### Description
Start the rabbitMQ publisher.
### Method
N/A (Method Signature)
### Endpoint
N/A
### Parameters
N/A
### Request Example
N/A
### Response
N/A
### Response Example
N/A
```
--------------------------------
### Create WebSocketClient with default options
Source: https://vertx.io/docs/5.1.2/apidocs/io/vertx/core/http/class-use/WebSocketClient.html
Creates a WebSocket client using the default configuration. This is a convenient way to get started with WebSocket client functionality.
```APIDOC
## Vertx.createWebSocketClient()
### Description
Creates a WebSocket client using default options.
### Method
`default WebSocketClient`
### Endpoint
N/A (SDK method)
### Parameters
None
### Response
- **WebSocketClient**: An instance of WebSocketClient configured with default settings.
```
--------------------------------
### start()
Source: https://vertx.io/docs/apidocs/index-all.html
Starts a component or service. This method is used across various Vert.x modules like CamelBridge, Verticles, Consul Watches, JmxReporter, ShellService, RabbitMQClient, and RabbitMQPublisher.
```APIDOC
## start()
### Description
Starts the component or service. This is typically an asynchronous operation.
### Method
This is a method signature, not an HTTP endpoint.
### Usage
This method is intended to be called to initiate the operation of various Vert.x components.
### Code Example
```java
// Example for io.vertx.core.AbstractVerticle
public class MyVerticle extends AbstractVerticle {
@Override
public void start() {
// Your start-up code here
System.out.println("Verticle started!");
}
}
```
```
--------------------------------
### Timeout Handler Example
Source: https://vertx.io/docs/5.1.2/vertx-web/java
Configures a timeout for requests matching a specific path pattern. Requests to paths starting with '/foo/' will timeout after 5000 milliseconds.
```java
router.route("/foo/").handler(TimeoutHandler.create(5000));
```
--------------------------------
### rxStart
Source: https://vertx.io/docs/apidocs/io/vertx/rxjava3/rabbitmq/RabbitMQClient.html
Starts the RabbitMQ client (RxJava3 version).
```APIDOC
## rxStart client start
### Description
Starts the RabbitMQ client. Creates the connection and the channel.
### Method
`Completable rxStart()`
### Returns
- Completable: A Completable that completes when the client has started.
```
--------------------------------
### Getting Started with Vert.x Oracle Client
Source: https://vertx.io/docs/5.1.2/vertx-oracle-client/java
Connect to an Oracle database, execute a simple query, and close the client pool. Ensure you have configured OracleConnectOptions and PoolOptions.
```java
OracleConnectOptions connectOptions = new OracleConnectOptions()
.setPort(1521)
.setHost("the-host")
.setDatabase("the-db")
.setUser("user")
.setPassword("secret");
// Pool options
PoolOptions poolOptions = new PoolOptions()
.setMaxSize(5);
// Create the client pool
Pool client = OracleBuilder.pool()
.with(poolOptions)
.connectingTo(connectOptions)
.build();
// A simple query
client
.query("SELECT * FROM users WHERE id='julien'")
.execute()
.onComplete(ar -> {
if (ar.succeeded()) {
RowSet result = ar.result();
System.out.println("Got " + result.size() + " rows ");
} else {
System.out.println("Failure: " + ar.cause().getMessage());
}
// Now close the pool
client.close();
});
```
--------------------------------
### Get Metrics Snapshot by Base Name
Source: https://vertx.io/docs/5.1.2/apidocs/io/vertx/rxjava3/ext/dropwizard/MetricsService.html
Retrieves a snapshot of metrics for all metrics starting with the given base name. Aggregates metrics if running in a scaled environment.
```APIDOC
## getMetricsSnapshot
### Description
Will return the metrics that begins with the `baseName`, null if no metrics is available. In the case of scaled servers, the JsonObject returns an aggregation of the metrics as the dropwizard backend reports to a single server.
### Method
JsonObject
### Parameters
#### Path Parameters
- **baseName** (String) -
### Returns
- **JsonObject** - the map of metrics where the key is the name of the metric and the value is the json data representing that metric
```
--------------------------------
### KeyStoreOptions Usage
Source: https://vertx.io/docs/5.1.2/apidocs/io/vertx/core/net/KeyStoreOptions.html
Demonstrates how to configure KeyStoreOptions for an HttpServerOptions, showing both filesystem loading and buffer loading methods.
```APIDOC
## KeyStoreOptions Configuration
### Description
This section details how to configure `KeyStoreOptions` for `HttpServerOptions`, illustrating two primary methods: loading from a file path and loading from a buffer.
### Usage Examples
#### Loading from File Path
This example shows how to set `KeyStoreOptions` by specifying the type, path, and password of the keystore file.
```java
HttpServerOptions options = HttpServerOptions.httpServerOptions();
options.setKeyCertOptions(new KeyStoreOptions().setType("JKS").setPath("/mykeystore.jks").setPassword("foo"));
```
#### Loading from Buffer
This example demonstrates setting `KeyStoreOptions` using a `Buffer` containing the keystore data, along with the type and password.
```java
Buffer store = vertx.fileSystem().readFileBlocking("/mykeystore.jks");
options.setKeyCertOptions(new KeyStoreOptions().setType("JKS").setValue(store).setPassword("foo"));
```
### Using Specific Subclasses (JksOptions)
`KeyStoreOptions` provides specific subclasses like `JksOptions` which pre-configure the type. This example shows using `JksOptions` to set the path and password.
```java
HttpServerOptions options = HttpServerOptions.httpServerOptions();
options.setKeyCertOptions(new JksOptions().setPath("/mykeystore.jks").setPassword("foo"));
```
### Methods
- `setType(String type)`: Sets the type of the keystore (e.g., "JKS", "PKCS12").
- `setPath(String path)`: Sets the file system path to the keystore.
- `setValue(Buffer value)`: Sets the keystore content as a `Buffer`.
- `setPassword(String password)`: Sets the password for the keystore.
```
--------------------------------
### start (synchronous)
Source: https://vertx.io/docs/5.1.2/apidocs/io/vertx/core/AbstractVerticle.html
For simple, synchronous startup tasks, override this method.
```APIDOC
## Method Details
### start
public void start() throws Exception
If your verticle does a simple, synchronous start-up then override this method and put your start-up code in here.
Throws:
`Exception`
```
--------------------------------
### Create MongoUserUtil with MongoClient
Source: https://vertx.io/docs/5.1.2/apidocs/io/vertx/ext/auth/mongo/class-use/MongoUserUtil.html
Creates a new instance of MongoUserUtil using the provided MongoClient. This is a convenient way to get started with default authentication and authorization options.
```APIDOC
## MongoUserUtil.create(MongoClient client)
### Description
Creates a new instance of MongoUserUtil using the provided MongoClient. This is a convenient way to get started with default authentication and authorization options.
### Method
`static`
### Endpoint
N/A (SDK method)
### Parameters
#### Path Parameters
N/A
#### Query Parameters
N/A
#### Request Body
N/A
### Request Example
N/A
### Response
#### Success Response
- **MongoUserUtil** (MongoUserUtil) - An instance of MongoUserUtil.
#### Response Example
N/A
```
--------------------------------
### getRebalanceDelay
Source: https://vertx.io/docs/apidocs/io/vertx/spi/cluster/ignite/IgniteCacheOptions.html
Gets the delay in milliseconds before rebalancing starts automatically after a node joins or leaves the topology. This method is deprecated and users should use the baseline topology feature instead.
```APIDOC
## getRebalanceDelay
### Description
Gets delay in milliseconds upon a node joining or leaving topology (or crash) after which rebalancing should be started automatically. Rebalancing should be delayed if you plan to restart nodes after they leave topology, or if you plan to start multiple nodes at once or one after another and don't want to repartition and rebalance until all nodes are started. For better efficiency user should usually make sure that new nodes get placed on the same place of consistent hash ring as the left nodes, and that nodes are restarted before this delay expires. As an example, node IP address and port combination may be used in this case. Default value is `0` which means that repartitioning and rebalancing will start immediately upon node leaving topology. If `-1` is returned, then rebalancing will only be started manually by calling rebalance() method or from management console.
### Method
GET
### Endpoint
/rebalanceDelay
### Returns
- **long**: Rebalancing delay, `0` to start rebalancing immediately, `-1` to start rebalancing manually, or positive value to specify delay in milliseconds after which rebalancing should start automatically.
```
--------------------------------
### KeyStoreOptions Configuration
Source: https://vertx.io/docs/apidocs/io/vertx/core/net/KeyStoreOptions.html
Demonstrates how to configure KeyStoreOptions to load keystore information from the filesystem or a buffer.
```APIDOC
## KeyStoreOptions Usage
### Description
Configures private key and/or certificates based on a `KeyStore`. This can be used as a key store (containing a private key and its certificate) or a trust store (containing a list of trusted certificates).
### Usage Examples
**Loading from Filesystem:**
```java
HttpServerOptions options = HttpServerOptions.httpServerOptions();
options.setKeyCertOptions(new KeyStoreOptions().setType("JKS").setPath("/mykeystore.jks").setPassword("foo"));
```
**Loading from Buffer:**
```java
Buffer store = vertx.fileSystem().readFileBlocking("/mykeystore.jks");
options.setKeyCertOptions(new KeyStoreOptions().setType("JKS").setValue(store).setPassword("foo"));
```
**Using Subclasses (JksOptions/PfxOptions):**
```java
HttpServerOptions options = HttpServerOptions.httpServerOptions();
options.setKeyCertOptions(new JksOptions().setPath("/mykeystore.jks").setPassword("foo"));
```
### Methods
- **`setType(String type)`**: Sets the type of the keystore (e.g., "JKS").
- **`setPath(String path)`**: Sets the path to the keystore file on the filesystem.
- **`setValue(Buffer value)`**: Sets the keystore content directly as a `Buffer`.
- **`setPassword(String password)`**: Sets the password for the keystore.
### Note
Specific subclasses like `JksOptions` and `PfxOptions` are available to pre-set the keystore type.
```
--------------------------------
### Access HTTP Request Headers
Source: https://vertx.io/docs/5.1.2/vertx-core/java
Shows how to retrieve HTTP request headers using the `headers()` method, which returns a MultiMap. This example demonstrates getting the 'User-Agent' header.
```java
MultiMap headers = request.headers();
// Get the User-Agent:
System.out.println("User agent is " + headers.get("user-agent"));
```