Class GremlinClient
Provides a mechanism for submitting Gremlin requests to one Gremlin Server.
Inherited Members
Namespace: Gremlin.Net.Driver
Assembly: Gremlin.Net.dll
Syntax
public class GremlinClient : IGremlinClient, IDisposable
Constructors
GremlinClient(GremlinServer, IMessageSerializer?, ConnectionPoolSettings?, Action<ClientWebSocketOptions>?, string?, bool, ILoggerFactory?)
Initializes a new instance of the GremlinClient class for the specified Gremlin Server.
Declaration
public GremlinClient(GremlinServer gremlinServer, IMessageSerializer? messageSerializer = null, ConnectionPoolSettings? connectionPoolSettings = null, Action<ClientWebSocketOptions>? webSocketConfiguration = null, string? sessionId = null, bool disableCompression = false, ILoggerFactory? loggerFactory = null)
Parameters
Type | Name | Description |
---|---|---|
GremlinServer | gremlinServer | The GremlinServer the requests should be sent to. |
IMessageSerializer | messageSerializer | A IMessageSerializer instance to serialize messages sent to and received from the server. |
ConnectionPoolSettings | connectionPoolSettings | The ConnectionPoolSettings for the connection pool. |
Action<ClientWebSocketOptions> | webSocketConfiguration | A delegate that will be invoked with the ClientWebSocketOptions object used to configure WebSocket connections. |
string | sessionId | The session Id if Gremlin Client in session mode, defaults to null as session-less Client. |
bool | disableCompression | Whether to disable compression. Compression is only supported since .NET 6. There it is also enabled by default. Note that compression might make your application susceptible to attacks like CRIME/BREACH. Compression should therefore be turned off if your application sends sensitive data to the server as well as data that could potentially be controlled by an untrusted user. |
ILoggerFactory | loggerFactory | A factory to create loggers. If not provided, then nothing will be logged. |
GremlinClient(GremlinServer, GraphSONReader, GraphSONWriter, ConnectionPoolSettings?, Action<ClientWebSocketOptions>?, string?)
Initializes a new instance of the GremlinClient class for the specified Gremlin Server.
Declaration
[Obsolete("This constructor is obsolete. Use the constructor that takes a IMessageSerializer instead.")]
public GremlinClient(GremlinServer gremlinServer, GraphSONReader graphSONReader, GraphSONWriter graphSONWriter, ConnectionPoolSettings? connectionPoolSettings = null, Action<ClientWebSocketOptions>? webSocketConfiguration = null, string? sessionId = null)
Parameters
Type | Name | Description |
---|---|---|
GremlinServer | gremlinServer | The GremlinServer the requests should be sent to. |
GraphSONReader | graphSONReader | A GraphSONReader instance to read received GraphSON data. |
GraphSONWriter | graphSONWriter | a GraphSONWriter instance to write GraphSON data. |
ConnectionPoolSettings | connectionPoolSettings | The ConnectionPoolSettings for the connection pool. |
Action<ClientWebSocketOptions> | webSocketConfiguration | A delegate that will be invoked with the ClientWebSocketOptions object used to configure WebSocket connections. |
string | sessionId | The session Id if Gremlin Client in session mode, defaults to null as session-less Client. |
GremlinClient(GremlinServer, GraphSONReader?, GraphSONWriter?, string, ConnectionPoolSettings?, Action<ClientWebSocketOptions>?, string?)
Initializes a new instance of the GremlinClient class for the specified Gremlin Server.
Declaration
[Obsolete("This constructor is obsolete. Use the constructor that takes a IMessageSerializer instead.")]
public GremlinClient(GremlinServer gremlinServer, GraphSONReader? graphSONReader, GraphSONWriter? graphSONWriter, string mimeType, ConnectionPoolSettings? connectionPoolSettings = null, Action<ClientWebSocketOptions>? webSocketConfiguration = null, string? sessionId = null)
Parameters
Type | Name | Description |
---|---|---|
GremlinServer | gremlinServer | The GremlinServer the requests should be sent to. |
GraphSONReader | graphSONReader | A GraphSONReader instance to read received GraphSON data. |
GraphSONWriter | graphSONWriter | a GraphSONWriter instance to write GraphSON data. |
string | mimeType | The GraphSON version mime type, defaults to latest supported by the server. |
ConnectionPoolSettings | connectionPoolSettings | The ConnectionPoolSettings for the connection pool. |
Action<ClientWebSocketOptions> | webSocketConfiguration | A delegate that will be invoked with the ClientWebSocketOptions object used to configure WebSocket connections. |
string | sessionId | The session Id if Gremlin Client in session mode, defaults to null as session-less Client. |
Properties
NrConnections
Gets the number of open connections.
Declaration
public int NrConnections { get; }
Property Value
Type | Description |
---|---|
int |
Methods
Dispose()
Declaration
public void Dispose()
Dispose(bool)
Releases the resources used by the GremlinClient instance.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | Specifies whether managed resources should be released. |
SubmitAsync<T>(RequestMessage, CancellationToken)
Submits a request message as an asynchronous operation.
Declaration
public Task<ResultSet<T>> SubmitAsync<T>(RequestMessage requestMessage, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
RequestMessage | requestMessage | The RequestMessage to send. |
CancellationToken | cancellationToken | The token to cancel the operation. The default value is None. |
Returns
Type | Description |
---|---|
Task<ResultSet<T>> | A ResultSet<T> containing the data and status attributes returned from the server. |
Type Parameters
Name | Description |
---|---|
T | The type of the expected results. |
Exceptions
Type | Condition |
---|---|
ResponseException | Thrown when a response is received from Gremlin Server that indicates that an error occurred. |