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 voidaddConnectionCloseListener(TarantoolConnectionCloseListener listener)Add a listener which is invoked when the connection is closed.voidaddConnectionFailureListener(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.ChannelgetChannel()Get the Netty channel baking this connectionInetSocketAddressgetRemoteAddress()Get the Tarantool server address for this connectionTarantoolVersiongetVersion()Get the Tarantool server versionbooleanisConnected()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- aTarantoolConnectionFailureListenerinstance
-
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- aTarantoolConnectionCloseListenerinstance
-
-