Class WebsocketKeyValueClient
- java.lang.Object
-
- io.fluxcapacitor.javaclient.common.websocket.AbstractWebsocketClient
-
- io.fluxcapacitor.javaclient.persisting.keyvalue.client.WebsocketKeyValueClient
-
- All Implemented Interfaces:
KeyValueClient,AutoCloseable
public class WebsocketKeyValueClient extends AbstractWebsocketClient implements KeyValueClient
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.fluxcapacitor.javaclient.common.websocket.AbstractWebsocketClient
AbstractWebsocketClient.WebSocketRequest
-
-
Field Summary
-
Fields inherited from class io.fluxcapacitor.javaclient.common.websocket.AbstractWebsocketClient
defaultObjectMapper
-
-
Constructor Summary
Constructors Constructor Description WebsocketKeyValueClient(String endPointUrl, WebSocketClient.Properties properties)WebsocketKeyValueClient(URI endpointUri, WebSocketClient.Properties properties)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AwaitabledeleteValue(String key)Deletes the value associated with the given key.Data<byte[]>getValue(String key)Returns theDataobject associated with the given key.AwaitableputValue(String key, Data<byte[]> value, Guarantee guarantee)Adds or replaces the given value in the key value store.CompletableFuture<Boolean>putValueIfAbsent(String key, Data<byte[]> value)Adds the given value in the key value store if the key is not already mapped to a value.protected AwaitablestoreValues(List<KeyValuePair> keyValuePairs)-
Methods inherited from class io.fluxcapacitor.javaclient.common.websocket.AbstractWebsocketClient
close, close, getSession, isClosed, onClose, onError, onMessage, retryOutstandingRequests, send, sendRequest, sendRequestAndWait
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.fluxcapacitor.javaclient.persisting.keyvalue.client.KeyValueClient
close
-
-
-
-
Constructor Detail
-
WebsocketKeyValueClient
public WebsocketKeyValueClient(String endPointUrl, WebSocketClient.Properties properties)
-
WebsocketKeyValueClient
public WebsocketKeyValueClient(URI endpointUri, WebSocketClient.Properties properties)
-
-
Method Detail
-
storeValues
protected Awaitable storeValues(List<KeyValuePair> keyValuePairs)
-
putValue
public Awaitable putValue(String key, Data<byte[]> value, Guarantee guarantee)
Description copied from interface:KeyValueClientAdds or replaces the given value in the key value store.- Specified by:
putValuein interfaceKeyValueClient- Parameters:
key- The key associated with this valuevalue- The value to storeguarantee- The guarantee for storing- Returns:
- a handle that enables clients to wait until the value was sent or stored depending on the guarantee
-
putValueIfAbsent
public CompletableFuture<Boolean> putValueIfAbsent(String key, Data<byte[]> value)
Description copied from interface:KeyValueClientAdds the given value in the key value store if the key is not already mapped to a value.- Specified by:
putValueIfAbsentin interfaceKeyValueClient- Parameters:
key- The key associated with this valuevalue- The value to store- Returns:
- a handle that enables clients to wait until the value was sent or stored depending on the guarantee
-
getValue
public Data<byte[]> getValue(String key)
Description copied from interface:KeyValueClientReturns theDataobject associated with the given key. Returnsnullif there is no associated value.- Specified by:
getValuein interfaceKeyValueClient- Parameters:
key- The key associated with the value- Returns:
- the value for the given key or null
-
deleteValue
public Awaitable deleteValue(String key)
Description copied from interface:KeyValueClientDeletes the value associated with the given key.- Specified by:
deleteValuein interfaceKeyValueClient- Parameters:
key- The key associated with this value- Returns:
- a handle that enables clients to wait until the command was safely sent to the store
-
-