public abstract class RedisQueue extends Object implements IQueue
IQueue.
Implementation:
setRedisHashName(String).
setRedisListName(String).
setRedisSortedSetName(String).| Constructor and Description |
|---|
RedisQueue() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract IQueueMessage |
deserialize(byte[] msgData)
Deserilizes a queue message.
|
void |
destroy()
Destroy method.
|
int |
ephemeralSize()
Gets ephemeral-storage's number of items.
|
void |
finish(IQueueMessage msg)
Called when finish processing the message to cleanup ephemeral storage.
|
protected redis.clients.jedis.JedisPool |
getJedisPool() |
Collection<IQueueMessage> |
getOrphanMessages(long thresholdTimestampMs)
Gets all orphan messages (messages that were left in ephemeral storage
for a long time).
|
String |
getRedisHashName() |
String |
getRedisHostAndPort()
Redis' host and port scheme (format
host:port). |
String |
getRedisListName() |
String |
getRedisSortedSetName() |
RedisQueue |
init()
Init method.
|
boolean |
moveFromEphemeralToQueueStorage(IQueueMessage msg)
Moves a message from ephemeral back to queue storage.
|
boolean |
queue(IQueueMessage msg)
Queues a message.
|
int |
queueSize()
Gets queue's number of items.
|
protected boolean |
remove(IQueueMessage msg)
Removes a message completely.
|
boolean |
requeue(IQueueMessage msg)
Re-queues a message.
|
boolean |
requeueSilent(IQueueMessage msg)
Silently re-queues a message.
|
protected abstract byte[] |
serialize(IQueueMessage msg)
Serializes a queue message to store in Redis.
|
RedisQueue |
setJedisPool(redis.clients.jedis.JedisPool jedisPool) |
RedisQueue |
setRedisHashName(String redisHashName) |
RedisQueue |
setRedisHostAndPort(String redisHostAndPort)
Sets Redis' host and port scheme (format
host:port). |
RedisQueue |
setRedisListName(String redisListName) |
RedisQueue |
setRedisSortedSetName(String redisSortedSetName) |
protected boolean |
storeNew(IQueueMessage msg)
Stores a new message.
|
protected boolean |
storeOld(IQueueMessage msg)
Re-stores an old message (called by
requeue(IQueueMessage) or
requeueSilent(IQueueMessage). |
IQueueMessage |
take()
Takes a message out of queue.
|
public String getRedisHostAndPort()
host:port).public RedisQueue setRedisHostAndPort(String redisHostAndPort)
host:port).redisHostAndPort - public String getRedisHashName()
public RedisQueue setRedisHashName(String redisHashName)
public String getRedisListName()
public RedisQueue setRedisListName(String redisListName)
public String getRedisSortedSetName()
public RedisQueue setRedisSortedSetName(String redisSortedSetName)
protected redis.clients.jedis.JedisPool getJedisPool()
public RedisQueue setJedisPool(redis.clients.jedis.JedisPool jedisPool)
public RedisQueue init()
public void destroy()
protected abstract byte[] serialize(IQueueMessage msg)
msg - protected abstract IQueueMessage deserialize(byte[] msgData)
msgData - protected boolean remove(IQueueMessage msg)
msg - protected boolean storeNew(IQueueMessage msg)
msg - protected boolean storeOld(IQueueMessage msg)
requeue(IQueueMessage) or
requeueSilent(IQueueMessage).msg - public boolean queue(IQueueMessage msg)
Implementation flow:
public boolean requeue(IQueueMessage msg)
Implementation flow:
Note: ephemeral storage implementation is optional, depends on implementation.
public boolean requeueSilent(IQueueMessage msg)
Implementation flow:
Note: ephemeral storage implementation is optional, depends on implementation.
requeueSilent in interface IQueuepublic void finish(IQueueMessage msg)
Implementation flow:
Note: ephemeral storage implementation is optional, depends on implementation.
public IQueueMessage take()
Implementation flow:
Note: ephemeral storage implementation is optional, depends on implementation.
public Collection<IQueueMessage> getOrphanMessages(long thresholdTimestampMs)
getOrphanMessages in interface IQueuethresholdTimestampMs - public boolean moveFromEphemeralToQueueStorage(IQueueMessage msg)
Implementation flow:
moveFromEphemeralToQueueStorage in interface IQueuetrue if a move has been made, false otherwise
(e.g. the message didn't exist in ephemeral storage)public int queueSize()
public int ephemeralSize()
Note: ephemeral storage implementation is optional, depends on implementation.
ephemeralSize in interface IQueueCopyright © 2015 DDTH. All Rights Reserved.