Package com.arangodb
Class ArangoDB.Builder
java.lang.Object
com.arangodb.ArangoDB.Builder
- Enclosing interface:
- ArangoDB
Builder class to build an instance of
ArangoDB
.- Author:
- Mark Vollmary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionacquireHostList
(Boolean acquireHostList) Whether the driver should acquire a list of available coordinators in an ArangoDB cluster or a single server with active failover.acquireHostListInterval
(Integer acquireHostListInterval) Setting the Interval for acquireHostListasyncExecutor
(Executor executor) Deprecated.for removal.build()
Returns an instance ofArangoDB
.Sets the chunk size whenProtocol.VST
is used.compression
(Compression compression) Sets thecontent-encoding
andaccept-encoding
to use for HTTP requests and the related algorithm to encode and decode the transferred data.compressionLevel
(Integer level) Sets the compression level.compressionThreshold
(Integer threshold) Sets the minimum HTTP request body size (in bytes) to trigger compression.connectionTtl
(Long connectionTtl) Set the time to live of an inactive connection.protected HostHandler
createHostHandler
(HostResolver hostResolver) protected Collection<Host>
createHostList
(ConnectionFactory connectionFactory) protected HostResolver
createHostResolver
(Collection<Host> hosts, ConnectionFactory connectionFactory) Adds a host to connect to.Sets the JWT for the user authentication.keepAliveInterval
(Integer keepAliveInterval) Set the keep-alive interval for VST connections.loadBalancingStrategy
(LoadBalancingStrategy loadBalancingStrategy) Sets the load balancing strategy to be used in an ArangoDB cluster setup.loadProperties
(ArangoConfigProperties properties) maxConnections
(Integer maxConnections) Sets the maximum number of connections the built in connection pool will open per host.Sets the password for the user for authentication.protocolConfig
(ProtocolConfig protocolConfig) Configuration specific forProtocolProvider
.protected ProtocolProvider
protocolProvider
(Protocol protocol) responseQueueTimeSamples
(Integer responseQueueTimeSamples) Setting the amount of samples kept for queue time metricsserde
(ArangoSerde serde) Sets the serde for the user data.serdeProviderClass
(Class<? extends ArangoSerdeProvider> serdeProviderClass) Sets the serde provider to be used to instantiate the user data serde.sslContext
(SSLContext sslContext) Sets the SSL context to be used whentrue
is passed throughuseSsl(Boolean)
.Sets the connection and request timeout in milliseconds.Sets the username to use for authentication.If set totrue
SSL will be used when connecting to an ArangoDB server.verifyHost
(Boolean verifyHost) Set whether hostname verification is enabled
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
build
Returns an instance ofArangoDB
.- Returns:
ArangoDB
-
loadProperties
-
protocol
-
host
Adds a host to connect to. Multiple hosts can be added to provide fallbacks.- Parameters:
host
- address of the hostport
- port of the host- Returns:
ArangoDB.Builder
-
timeout
Sets the connection and request timeout in milliseconds.- Parameters:
timeout
- timeout in milliseconds- Returns:
ArangoDB.Builder
-
user
Sets the username to use for authentication.- Parameters:
user
- the user in the database (default:root
)- Returns:
ArangoDB.Builder
-
password
Sets the password for the user for authentication.- Parameters:
password
- the password of the user in the database (default:null
)- Returns:
ArangoDB.Builder
-
jwt
Sets the JWT for the user authentication.- Parameters:
jwt
- token to use (default:null
)- Returns:
ArangoDB.Builder
-
useSsl
If set totrue
SSL will be used when connecting to an ArangoDB server.- Parameters:
useSsl
- whether or not use SSL (default:false
)- Returns:
ArangoDB.Builder
-
sslContext
Sets the SSL context to be used whentrue
is passed throughuseSsl(Boolean)
.- Parameters:
sslContext
- SSL context to be used- Returns:
ArangoDB.Builder
-
verifyHost
Set whether hostname verification is enabled- Parameters:
verifyHost
-true
if enabled- Returns:
ArangoDB.Builder
-
chunkSize
Sets the chunk size whenProtocol.VST
is used.- Parameters:
chunkSize
- size of a chunk in bytes- Returns:
ArangoDB.Builder
-
maxConnections
Sets the maximum number of connections the built in connection pool will open per host.Defaults:
Protocol.VST
== 1Protocol.HTTP_JSON
== 20Protocol.HTTP_VPACK
== 20- Parameters:
maxConnections
- max number of connections- Returns:
ArangoDB.Builder
-
connectionTtl
Set the time to live of an inactive connection. After this time of inactivity the connection will be closed automatically.- Parameters:
connectionTtl
- the time to live of a connection in milliseconds- Returns:
ArangoDB.Builder
-
keepAliveInterval
Set the keep-alive interval for VST connections. If set, every VST connection will perform a no-op request everykeepAliveInterval
seconds, to avoid to be closed due to inactivity by the server (or by the external environment, eg. firewall, intermediate routers, operating system).- Parameters:
keepAliveInterval
- interval in seconds- Returns:
ArangoDB.Builder
-
acquireHostList
Whether the driver should acquire a list of available coordinators in an ArangoDB cluster or a single server with active failover. In case of Active-Failover deployment set totrue
to enable automatic master discovery.The host list will be used for failover and load balancing.
- Parameters:
acquireHostList
- whether automatically acquire a list of available hosts (default: false)- Returns:
ArangoDB.Builder
-
acquireHostListInterval
Setting the Interval for acquireHostList- Parameters:
acquireHostListInterval
- Interval in milliseconds- Returns:
ArangoDB.Builder
-
loadBalancingStrategy
Sets the load balancing strategy to be used in an ArangoDB cluster setup. In case of Active-Failover deployment set toLoadBalancingStrategy.NONE
or not set at all, since that would be the default.- Parameters:
loadBalancingStrategy
- the load balancing strategy to be used (default:LoadBalancingStrategy.NONE
- Returns:
ArangoDB.Builder
-
responseQueueTimeSamples
Setting the amount of samples kept for queue time metrics- Parameters:
responseQueueTimeSamples
- amount of samples to keep- Returns:
ArangoDB.Builder
-
serde
Sets the serde for the user data. This is used to serialize and deserialize all the data payload such as: - documents, vertexes, edges - AQL bind vars - body payload of requests and responses inArangoDB.execute(Request, Class)
However, note that the following types will always be serialized and deserialized using the internal serde: -
JsonNode
-RawJson
-RawBytes
-BaseDocument
-BaseEdgeDocument
- Parameters:
serde
- custom serde for the user data- Returns:
ArangoDB.Builder
-
serdeProviderClass
Sets the serde provider to be used to instantiate the user data serde. Ignored ifserde(ArangoSerde)
is used.- Parameters:
serdeProviderClass
- class of the serde provider, it must have a public no-args constructor- Returns:
ArangoDB.Builder
-
asyncExecutor
Deprecated.for removal. To consume the responses in a custom executor use async CompletableFuture methods.Sets the downstream async executor that will be used to consume the responses of the async API, that are returned asCompletableFuture
- Parameters:
executor
- async downstream executor- Returns:
ArangoDB.Builder
-
compression
Sets thecontent-encoding
andaccept-encoding
to use for HTTP requests and the related algorithm to encode and decode the transferred data. (default:Compression.NONE
)- Parameters:
compression
- format- Returns:
ArangoDB.Builder
- Since:
- ArangoDB 3.12
-
compressionThreshold
Sets the minimum HTTP request body size (in bytes) to trigger compression. (default:1024
)- Parameters:
threshold
- body size (in bytes)- Returns:
ArangoDB.Builder
- Since:
- ArangoDB 3.12
-
compressionLevel
Sets the compression level. (default:6
)- Parameters:
level
- compression level between 0 and 9- Returns:
ArangoDB.Builder
- Since:
- ArangoDB 3.12
-
protocolConfig
Configuration specific forProtocolProvider
.- Returns:
ArangoDB.Builder
-
protocolProvider
-
createHostHandler
-
createHostResolver
protected HostResolver createHostResolver(Collection<Host> hosts, ConnectionFactory connectionFactory) -
createHostList
-