Skip to content

Commit

Permalink
[DE-535] Java Driver: configure Vert.x instance (#540)
Browse files Browse the repository at this point in the history
* Java Driver: reuse Vert.x

* Java Driver: documented HTTP protocol configuration to reuse Vert.x instance

* Apply to other versions

---------

Co-authored-by: Simran Spiller <simran@arangodb.com>
  • Loading branch information
rashtao and Simran-B committed Jun 13, 2024
1 parent 1295042 commit 2bd60cb
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,33 @@ Here are examples to integrate configuration properties from different sources:
- `acquireHostListInterval(Integer)`: acquireHostList interval (ms), (default: `3_600_000`, 1 hour)
- `loadBalancingStrategy(LoadBalancingStrategy)`: load balancing strategy, possible values are: `NONE`, `ROUND_ROBIN`, `ONE_RANDOM`, (default: `NONE`)
- `responseQueueTimeSamples(Integer)`: amount of samples kept for queue time metrics, (default: `10`)
- `serde(ArangoSerde)`: serde to serialize and deserialize user-data
- `serde(ArangoSerde)`: serde to serialize and deserialize user-data
- `protocolConfig(ProtocolConfig)`: configuration specific for the used protocol provider implementation

### HTTP Protocol Provider Configuration

The `ProtocolConfig` for the default HTTP protocol provider can be created via:

```java
HttpProtocolConfig.builder()
// ...
.build();
```

and configured using the following builder methods:

- `vertx(Vertx)`: Vert.x instance to use. If not set, a new instance is created.

For example, to reuse the existing Vert.x instance:

```java
HttpProtocolConfig.builder()
.protocolConfig(HttpProtocolConfig.builder()
.vertx(Vertx.currentContext().owner())
.build()
)
.build();
```

### Config File Properties

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,33 @@ Here are examples to integrate configuration properties from different sources:
- `acquireHostListInterval(Integer)`: acquireHostList interval (ms), (default: `3_600_000`, 1 hour)
- `loadBalancingStrategy(LoadBalancingStrategy)`: load balancing strategy, possible values are: `NONE`, `ROUND_ROBIN`, `ONE_RANDOM`, (default: `NONE`)
- `responseQueueTimeSamples(Integer)`: amount of samples kept for queue time metrics, (default: `10`)
- `serde(ArangoSerde)`: serde to serialize and deserialize user-data
- `serde(ArangoSerde)`: serde to serialize and deserialize user-data
- `protocolConfig(ProtocolConfig)`: configuration specific for the used protocol provider implementation

### HTTP Protocol Provider Configuration

The `ProtocolConfig` for the default HTTP protocol provider can be created via:

```java
HttpProtocolConfig.builder()
// ...
.build();
```

and configured using the following builder methods:

- `vertx(Vertx)`: Vert.x instance to use. If not set, a new instance is created.

For example, to reuse the existing Vert.x instance:

```java
HttpProtocolConfig.builder()
.protocolConfig(HttpProtocolConfig.builder()
.vertx(Vertx.currentContext().owner())
.build()
)
.build();
```

### Config File Properties

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,32 @@ Here are examples to integrate configuration properties from different sources:
- `compressionThreshold(Integer)`: the minimum HTTP request body size (in bytes) to trigger compression, (default: `1024`)
- `compressionLevel`: compression level between 0 and 9, (default: `6`)
- `serde(ArangoSerde)`: serde to serialize and deserialize user-data
- `protocolConfig(ProtocolConfig)`: configuration specific for the used protocol provider implementation

### HTTP Protocol Provider Configuration

The `ProtocolConfig` for the default HTTP protocol provider can be created via:

```java
HttpProtocolConfig.builder()
// ...
.build();
```

and configured using the following builder methods:

- `vertx(Vertx)`: Vert.x instance to use. If not set, a new instance is created.

For example, to reuse the existing Vert.x instance:

```java
HttpProtocolConfig.builder()
.protocolConfig(HttpProtocolConfig.builder()
.vertx(Vertx.currentContext().owner())
.build()
)
.build();
```

### Config File Properties

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,32 @@ Here are examples to integrate configuration properties from different sources:
- `compressionThreshold(Integer)`: the minimum HTTP request body size (in bytes) to trigger compression, (default: `1024`)
- `compressionLevel`: compression level between 0 and 9, (default: `6`)
- `serde(ArangoSerde)`: serde to serialize and deserialize user-data
- `protocolConfig(ProtocolConfig)`: configuration specific for the used protocol provider implementation

### HTTP Protocol Provider Configuration

The `ProtocolConfig` for the default HTTP protocol provider can be created via:

```java
HttpProtocolConfig.builder()
// ...
.build();
```

and configured using the following builder methods:

- `vertx(Vertx)`: Vert.x instance to use. If not set, a new instance is created.

For example, to reuse the existing Vert.x instance:

```java
HttpProtocolConfig.builder()
.protocolConfig(HttpProtocolConfig.builder()
.vertx(Vertx.currentContext().owner())
.build()
)
.build();
```

### Config File Properties

Expand Down

0 comments on commit 2bd60cb

Please sign in to comment.