Class AbstractRedisQueue<CLIENT extends redis.clients.jedis.commands.JedisCommands>
java.lang.Object
cn.sliew.carp.framework.queue.kekio.AbstractLifecycle
cn.sliew.carp.framework.queue.kekio.AbstractQueue
cn.sliew.carp.framework.queue.kekio.redis.AbstractRedisQueue<CLIENT>
- All Implemented Interfaces:
MonitorableQueue,Queue,org.springframework.context.Lifecycle,org.springframework.context.Phased,org.springframework.context.SmartLifecycle
- Direct Known Subclasses:
RedisQueue
public abstract class AbstractRedisQueue<CLIENT extends redis.clients.jedis.commands.JedisCommands>
extends AbstractQueue
implements MonitorableQueue
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface cn.sliew.carp.framework.queue.kekio.metrics.MonitorableQueue
MonitorableQueue.QueueStateNested classes/interfaces inherited from interface cn.sliew.carp.framework.queue.kekio.Queue
Queue.DeadMessageCallback, Queue.QueueCallback -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Integerprotected final com.fasterxml.jackson.databind.ObjectMapperprotected static final Stringprotected static final StringFields inherited from class cn.sliew.carp.framework.queue.kekio.AbstractQueue
ackTimeout, canPollMany, deadMessageHandlers, publisherFields inherited from interface cn.sliew.carp.framework.queue.kekio.Queue
MAX_RETRIESFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractRedisQueue(com.fasterxml.jackson.databind.ObjectMapper mapper, String name, QueueExecutor queueExecutor, Collection<MessageHandler> handlers, List<Queue.DeadMessageCallback> deadMessageHandlers, EventPublisher publisher, io.micrometer.core.instrument.MeterRegistry meterRegistry, Boolean fillExecutorEachCycle, Duration requeueDelay, Duration requeueMaxJitter, Boolean canPollMany, TemporalAmount ackTimeout, Integer lockTtlSeconds) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleananyZismember(redis.clients.jedis.commands.JedisCommands commands, String key, Set<String> members) abstract voidDenotes a queue implementation capable of processing multiple messages per poll.protected AbstractRedisQueue.Fingerprintfingerprint(Message message) protected StringfirstFingerprint(String key, AbstractRedisQueue.Fingerprint fingerprint) The expired time after which un-acknowledged messages will be retried.protected abstract StringA handler for messages that have failed to acknowledge delivery more than [Queue.ackTimeout] times.protected abstract Stringprotected abstract Stringprotected abstract Stringprotected abstract Stringprotected abstract Stringprotected voidhandleDeadMessage(Message message) protected StringDeprecated.Hashes the attributes property, which is mutableprotected Stringprotected intprotected intmulti(cn.sliew.milky.common.function.CheckedConsumer<redis.clients.jedis.Transaction, E> block) protected doublescore()protected doublescore(TemporalAmount delay) protected abstract voidprotected voidprotected abstract <T> Tprotected booleanMethods inherited from class cn.sliew.carp.framework.queue.kekio.AbstractQueue
doStart, doStop, getNameMethods inherited from class cn.sliew.carp.framework.queue.kekio.AbstractLifecycle
isRunning, start, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.Lifecycle
isRunning, start, stopMethods inherited from interface cn.sliew.carp.framework.queue.kekio.metrics.MonitorableQueue
containsMessage, fire, readStateMethods inherited from interface cn.sliew.carp.framework.queue.kekio.Queue
clear, getName, poll, poll, push, push, retryMethods inherited from interface org.springframework.context.SmartLifecycle
getPhase, isAutoStartup, stop
-
Field Details
-
lockTtlSeconds
-
mapper
protected final com.fasterxml.jackson.databind.ObjectMapper mapper -
READ_MESSAGE_SRC
- See Also:
-
READ_MESSAGE_WITH_LOCK_SRC
- See Also:
-
-
Constructor Details
-
AbstractRedisQueue
protected AbstractRedisQueue(com.fasterxml.jackson.databind.ObjectMapper mapper, String name, QueueExecutor queueExecutor, Collection<MessageHandler> handlers, List<Queue.DeadMessageCallback> deadMessageHandlers, EventPublisher publisher, io.micrometer.core.instrument.MeterRegistry meterRegistry, Boolean fillExecutorEachCycle, Duration requeueDelay, Duration requeueMaxJitter, Boolean canPollMany, TemporalAmount ackTimeout, Integer lockTtlSeconds)
-
-
Method Details
-
getQueueKey
-
getUnackedKey
-
getMessagesKey
-
getLocksKey
-
getAttemptsKey
-
cacheScript
public abstract void cacheScript() -
getReadMessageWithLockScriptSha
-
setReadMessageWithLockScriptSha
-
withJedis
-
withJedis
-
getAckTimeout
Description copied from interface:QueueThe expired time after which un-acknowledged messages will be retried.- Specified by:
getAckTimeoutin interfaceQueue
-
getDeadMessageHandlers
Description copied from interface:QueueA handler for messages that have failed to acknowledge delivery more than [Queue.ackTimeout] times.- Specified by:
getDeadMessageHandlersin interfaceQueue
-
canPollMany
Description copied from interface:QueueDenotes a queue implementation capable of processing multiple messages per poll.- Specified by:
canPollManyin interfaceQueue
-
getPublisher
- Specified by:
getPublisherin interfaceMonitorableQueue
-
handleDeadMessage
-
score
protected double score()- Returns:
- current time (plus optional delay) converted to a score for a Redis sorted set.
-
score
-
multi
-
hgetInt
-
hgetInt
-
zismember
-
anyZismember
-
firstFingerprint
-
hashV1
Deprecated.Hashes the attributes property, which is mutable -
hashV2
-
fingerprint
-