Package org.deltafi.common.queue.jedis
Class JedisKeyedBlockingQueue
java.lang.Object
org.deltafi.common.queue.jedis.JedisKeyedBlockingQueue
A keyed blocking queue based on the Jedis client library for Redis.
-
Constructor Summary
ConstructorsConstructorDescriptionJedisKeyedBlockingQueue(String url, String password, int maxIdle, int maxTotal) Constructs a JedisKeyedBlockingQueue. -
Method Summary
Modifier and TypeMethodDescriptionvoidDrop all queues in key list.booleanCheck if an object exists in the queue based on the search patternvoidPuts an object into the queue.voidPuts multiple objects into the queue.voidsetHeartbeat(String key) Publish a heartbeat in the form of a timestampTakes an object out of the queue.
-
Constructor Details
-
JedisKeyedBlockingQueue
public JedisKeyedBlockingQueue(String url, String password, int maxIdle, int maxTotal) throws URISyntaxException Constructs a JedisKeyedBlockingQueue.- Parameters:
url- the url of the redis serverpassword- the password for the redis servermaxIdle- the maximum number of idle pooled connections to the redis servermaxTotal- the maximum number of pooled connections to the redis 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:
key- the key for the queuevalue- the object
-
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 key/object pairss 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
-