Interface TarantoolConnection
-
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
TarantoolConnectionImpl
public interface TarantoolConnection extends AutoCloseable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addConnectionCloseListener(TarantoolConnectionCloseListener listener)
Add a listener which is invoked when the connection is closed.void
addConnectionFailureListener(TarantoolConnectionFailureListener listener)
Add a listener which is invoked when the connection is broken from the server side (e.g. server closed the connection or a network failure has occurred).io.netty.channel.Channel
getChannel()
Get the Netty channel baking this connectionInetSocketAddress
getRemoteAddress()
Get the Tarantool server address for this connectionTarantoolVersion
getVersion()
Get the Tarantool server versionboolean
isConnected()
Get the connection status<T> CompletableFuture<T>
sendRequest(TarantoolRequest request, MessagePackValueMapper resultMapper)
Send a prepared request to the Tarantool server and flush the buffer-
Methods inherited from interface java.lang.AutoCloseable
close
-
-
-
-
Method Detail
-
getRemoteAddress
InetSocketAddress getRemoteAddress() throws TarantoolClientException
Get the Tarantool server address for this connection- Returns:
- server address
- Throws:
TarantoolClientException
- if the client is not connected
-
getVersion
TarantoolVersion getVersion() throws TarantoolClientException
Get the Tarantool server version- Returns:
TarantoolVersion
- Throws:
TarantoolClientException
- if the client is not connected
-
isConnected
boolean isConnected()
Get the connection status- Returns:
- true, if the connection is alive
-
sendRequest
<T> CompletableFuture<T> sendRequest(TarantoolRequest request, MessagePackValueMapper resultMapper)
Send a prepared request to the Tarantool server and flush the buffer- Type Parameters:
T
- result type- Parameters:
request
- the requestresultMapper
- the mapper for response body- Returns:
- result future
-
getChannel
io.netty.channel.Channel getChannel()
Get the Netty channel baking this connection- Returns:
- channel
-
addConnectionFailureListener
void addConnectionFailureListener(TarantoolConnectionFailureListener listener)
Add a listener which is invoked when the connection is broken from the server side (e.g. server closed the connection or a network failure has occurred).- Parameters:
listener
- aTarantoolConnectionFailureListener
instance
-
addConnectionCloseListener
void addConnectionCloseListener(TarantoolConnectionCloseListener listener)
Add a listener which is invoked when the connection is closed. The internal channel may probably be in an invalid state at this moment.- Parameters:
listener
- aTarantoolConnectionCloseListener
instance
-
-