@ManagedResource @IntegrationManagedResource public class RedisQueueInboundGateway extends MessagingGatewaySupport implements ApplicationEventPublisherAware, BeanClassLoaderAware
IntegrationManagement.ManagementOverrides| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_RECEIVE_TIMEOUT |
static long |
DEFAULT_RECOVERY_INTERVAL |
messagingTemplatelifecycleCondition, lifecycleLockEXPRESSION_PARSER, loggerMETER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEDEFAULT_PHASE| Constructor and Description |
|---|
RedisQueueInboundGateway(String queueName,
RedisConnectionFactory connectionFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearQueue()
Clear the Redis Queue specified by
boundListOperations. |
protected void |
doStart()
Subclasses must implement this method with the start behavior.
|
protected void |
doStop()
Subclasses must implement this method with the stop behavior.
|
protected void |
doStop(Runnable callback)
Stop the component and invoke callback.
|
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
long |
getQueueSize()
Returns the size of the Queue specified by
boundListOperations. |
boolean |
isListening() |
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
void |
setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) |
void |
setBeanClassLoader(ClassLoader beanClassLoader) |
void |
setExtractPayload(boolean extractPayload) |
void |
setReceiveTimeout(long receiveTimeout)
This timeout (milliseconds) is used when retrieving elements from the queue
specified by
boundListOperations. |
void |
setRecoveryInterval(long recoveryInterval) |
void |
setSerializer(RedisSerializer<?> serializer) |
void |
setTaskExecutor(Executor taskExecutor) |
buildErrorMessage, getErrorChannel, getErrorMessageAttributes, getManagedName, getManagedType, getMessageCount, getMessageCountLong, getOverrides, getReplyChannel, getRequestChannel, isCountsEnabled, isLoggingEnabled, receive, receive, receiveMessage, receiveMessage, registerReplyMessageCorrelatorIfNecessary, reset, send, sendAndReceive, sendAndReceiveMessage, sendAndReceiveMessageReactive, setCountsEnabled, setErrorChannel, setErrorChannelName, setErrorMessageStrategy, setErrorOnTimeout, setLoggingEnabled, setManagedName, setManagedType, setReplyChannel, setReplyChannelName, setReplyMapper, setReplyTimeout, setRequestChannel, setRequestChannelName, setRequestMapper, setRequestTimeout, setShouldTrackdestroy, getPhase, getRole, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stopafterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetBeanName, getComponentNamemessageCountdestroy, registerMetricsCaptorpublic static final long DEFAULT_RECEIVE_TIMEOUT
public static final long DEFAULT_RECOVERY_INTERVAL
public RedisQueueInboundGateway(String queueName, RedisConnectionFactory connectionFactory)
queueName - Must not be an empty StringconnectionFactory - Must not be nullpublic void setExtractPayload(boolean extractPayload)
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
setApplicationEventPublisher in interface ApplicationEventPublisherAwarepublic void setBeanClassLoader(ClassLoader beanClassLoader)
setBeanClassLoader in interface BeanClassLoaderAwarepublic void setSerializer(RedisSerializer<?> serializer)
public void setReceiveTimeout(long receiveTimeout)
boundListOperations.
If the queue does contain elements, the data is retrieved immediately. However, if the queue is empty, the Redis connection is blocked until either an element can be retrieved from the queue or until the specified timeout passes.
A timeout of zero can be used to block indefinitely. If not set explicitly
the timeout value will default to 1000
See also: https://redis.io/commands/brpop
receiveTimeout - Must be non-negative. Specified in milliseconds.public void setTaskExecutor(Executor taskExecutor)
public void setRecoveryInterval(long recoveryInterval)
protected void onInit()
IntegrationObjectSupportonInit in class MessagingGatewaySupportpublic String getComponentType()
IntegrationObjectSupportgetComponentType in interface NamedComponentgetComponentType in class MessagingGatewaySupportprotected void doStart()
AbstractEndpointAbstractEndpoint.lifecycleLock.doStart in class MessagingGatewaySupportprotected void doStop(Runnable callback)
AbstractEndpointdoStop in class AbstractEndpointcallback - the Runnable to invoke.protected void doStop()
AbstractEndpointAbstractEndpoint.lifecycleLock.doStop in class MessagingGatewaySupportpublic boolean isListening()
@ManagedMetric public long getQueueSize()
boundListOperations. The queue is
represented by a Redis list. If the queue does not exist 0
is returned. See also https://redis.io/commands/llen@ManagedOperation public void clearQueue()
boundListOperations.