Package org.deltafi.common.queue.jackey
Class ValkeyKeyedBlockingQueue
java.lang.Object
org.deltafi.common.queue.jackey.ValkeyKeyedBlockingQueue
A keyed blocking queue based on the Jackey client library for Valkey.
-
Constructor Summary
ConstructorsConstructorDescriptionValkeyKeyedBlockingQueue(String url, String password, int maxIdle, int maxTotal) Constructs a JackeyKeyedBlockingQueue. -
Method Summary
Modifier and TypeMethodDescriptionvoidDrop all queues in key list.booleanCheck if an object exists in the queue based on the search patterngetItemsWithPrefix(String prefix) Find all keys with the given prefix and the associated valuesgetLongRunningTask(String key) Retrieves the value associated with the given key from the long-running tasksRetrieves a map of long-running taskskeys()Get a list of unique keys from valkeyvoidput(List<SortedSetEntry> items) Puts multiple objects into the queue.voidput(SortedSetEntry entry) Puts an object into the queue.voidrecordLongRunningTask(String key, String value) Records a long running task in the long-running tasksvoidRemove a long-running task with the specified keyvoidsetHeartbeat(String key) Publish a heartbeat in the form of a timestamplongsortedSetSize(String key) Get the size of the sorted setTakes an object out of the queue.
-
Constructor Details
-
ValkeyKeyedBlockingQueue
public ValkeyKeyedBlockingQueue(String url, String password, int maxIdle, int maxTotal) throws URISyntaxException Constructs a JackeyKeyedBlockingQueue.- Parameters:
url- the url of the valkey serverpassword- the password for the valkey servermaxIdle- the maximum number of idle pooled connections to the valkey servermaxTotal- the maximum number of pooled connections to the valkey server. This should be set higher than the expected number of keys in the queue.- Throws:
URISyntaxException- if the provided url is not valid
-
-
Method Details
-
put
Puts an object into the queue.- Parameters:
entry- the SortedSetEntry to add to the queue
-
exists
Check if an object exists in the queue based on the search pattern- Parameters:
key- the key for the objectsearch- the search pattern- Returns:
- true if the pattern exists
-
drop
Drop all queues in key list.- Parameters:
keys- list of keys
-
put
Puts multiple objects into the queue.- Parameters:
items- a list of SortedSetEntry to put into the queue
-
setHeartbeat
Publish a heartbeat in the form of a timestamp- Parameters:
key- the name of the component publishing the heartbeat
-
take
Takes an object out of the queue.This method will block until an object for the provided key is available. When multiple objects are available for the provided key, the earliest one put into the queue is retrieved.
- Parameters:
key- the key for the object- Returns:
- the object value type
-
keys
Get a list of unique keys from valkey- Returns:
- the set of keys
-
sortedSetSize
Get the size of the sorted set- Parameters:
key- the name of the sorted set- Returns:
- the number of elements in the sorted set
-
getLongRunningTasks
Retrieves a map of long-running tasks- Returns:
- a map containing the long running tasks
-
getLongRunningTask
Retrieves the value associated with the given key from the long-running tasks- Parameters:
key- the key used to retrieve the value- Returns:
- the value associated with the given key, or null if the key is not found
-
recordLongRunningTask
Records a long running task in the long-running tasks- Parameters:
key- the key used to retrieve the valuevalue- the value associated with the given key
-
removeLongRunningTask
Remove a long-running task with the specified key- Parameters:
key- the key of the task to be removed
-
getItemsWithPrefix
Find all keys with the given prefix and the associated values- Parameters:
prefix- to search for- Returns:
- map of keys to values with keys that match the prefix
-
getByKey
-