Warning:
Fauna is decommissioning FQL v4 on June 30, 2025.
This driver is not compatible with FQL v10, the latest version. Fauna accounts created after August 21, 2024 must use FQL v10.
Ensure you migrate existing projects to the official v10 driver by the v4 EOL date: https://github.com/fauna/fauna-jvm.
For more information, see the v4 end of life (EOL) announcement and related FAQ.
public final class Connection
extends java.lang.Object
implements java.lang.AutoCloseable
Relies on Netty for the underlying implementation.
The close() method must be called in order to
release Connection I/O resources
| Modifier and Type | Class and Description |
|---|---|
static class |
Connection.Builder
A builder for the
Connection instance. |
| Modifier and Type | Method and Description |
|---|---|
static Connection.Builder |
builder()
Returns a new
Connection.Builder instance. |
void |
close()
Releases any resources being held by the
Connection instance. |
java.util.concurrent.CompletableFuture<io.netty.handler.codec.http.FullHttpResponse> |
get(java.lang.String path)
Issues a
GET request with no parameters. |
java.util.concurrent.CompletableFuture<io.netty.handler.codec.http.FullHttpResponse> |
get(java.lang.String path,
java.util.Map<java.lang.String,java.util.List<java.lang.String>> params)
Issues a
GET request with the provided request parameters. |
long |
getLastTxnTime()
Get the freshest timestamp reported to this client.
|
Connection |
newSessionConnection(java.lang.String authToken)
Creates a new
Connection sharing its underneath I/O resources. |
java.util.concurrent.CompletableFuture<io.netty.handler.codec.http.FullHttpResponse> |
patch(java.lang.String path,
JsonNode body)
Issues a
PATCH request with the provided JSON request body. |
java.util.concurrent.CompletableFuture<io.netty.handler.codec.http.FullHttpResponse> |
post(java.lang.String path,
JsonNode body)
Issues a
POST request with the provided JSON request body. |
java.util.concurrent.CompletableFuture<io.netty.handler.codec.http.FullHttpResponse> |
put(java.lang.String path,
JsonNode body)
Issues a
PUT request with the provided JSON request body. |
void |
syncLastTxnTime(long newTxnTime)
Sync the freshest timestamp seen by this client.
|
public static Connection.Builder builder()
Connection.Builder instance.Connection.Builderpublic Connection newSessionConnection(java.lang.String authToken)
Connection sharing its underneath I/O resources. Queries submitted to a
session connection will be authenticated with the token provided. The close() method
must be called before releasing the connection.authToken - the token or key to be used to authenticate requests to the new ConnectionConnectionpublic void close()
Connection instance.close in interface java.lang.AutoCloseablepublic long getLastTxnTime()
public void syncLastTxnTime(long newTxnTime)
public java.util.concurrent.CompletableFuture<io.netty.handler.codec.http.FullHttpResponse> get(java.lang.String path)
throws java.io.IOException
GET request with no parameters.path - the relative path of the resource.CompletableFuture containing the HTTP Response.java.io.IOException - if the HTTP request cannot be issued.public java.util.concurrent.CompletableFuture<io.netty.handler.codec.http.FullHttpResponse> get(java.lang.String path,
java.util.Map<java.lang.String,java.util.List<java.lang.String>> params)
throws java.io.IOException
GET request with the provided request parameters.path - the relative path of the resource.params - a map containing the request parameters.CompletableFuture containing the HTTP response.java.io.IOException - if the HTTP request cannot be issued.public java.util.concurrent.CompletableFuture<io.netty.handler.codec.http.FullHttpResponse> post(java.lang.String path,
JsonNode body)
throws java.io.IOException
POST request with the provided JSON request body.path - the relative path of the resource.body - the JSON tree that will be serialized into the request body.CompletableFuture containing the HTTP response.java.io.IOException - if the HTTP request cannot be issued.public java.util.concurrent.CompletableFuture<io.netty.handler.codec.http.FullHttpResponse> put(java.lang.String path,
JsonNode body)
throws java.io.IOException
PUT request with the provided JSON request body.path - the relative path of the resource.body - the JSON tree that will be serialized into the request body.CompletableFuture containing the HTTP response.java.io.IOException - if the HTTP request cannot be issued.public java.util.concurrent.CompletableFuture<io.netty.handler.codec.http.FullHttpResponse> patch(java.lang.String path,
JsonNode body)
throws java.io.IOException
PATCH request with the provided JSON request body.path - the relative path of the resource.body - the JSON tree that will be serialized into the request body.CompletableFuture containing the HTTP response.java.io.IOException - if the HTTP request cannot be issued.