@ManagedResource
@IntegrationManagedResource
public class RedisQueueInboundGateway
extends org.springframework.integration.gateway.MessagingGatewaySupport
implements org.springframework.context.ApplicationEventPublisherAware
| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_RECEIVE_TIMEOUT |
static long |
DEFAULT_RECOVERY_INTERVAL |
messagingTemplatelifecycleCondition, lifecycleLockEXPRESSION_PARSER, logger| Constructor and Description |
|---|
RedisQueueInboundGateway(java.lang.String queueName,
org.springframework.data.redis.connection.RedisConnectionFactory connectionFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearQueue()
Clear the Redis Queue specified by
boundListOperations. |
protected void |
doStart() |
protected void |
doStop() |
protected void |
doStop(java.lang.Runnable callback) |
java.lang.String |
getComponentType() |
long |
getQueueSize()
Returns the size of the Queue specified by
boundListOperations. |
boolean |
isListening() |
protected void |
onInit() |
void |
setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) |
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(org.springframework.data.redis.serializer.RedisSerializer<?> serializer) |
void |
setTaskExecutor(java.util.concurrent.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, setLoggingEnabled, setManagedName, setManagedType, setReplyChannel, setReplyChannelName, setReplyMapper, setReplyTimeout, setRequestChannel, setRequestChannelName, setRequestMapper, setRequestTimeout, setShouldTrackdestroy, getPhase, getRole, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, setTaskScheduler, start, stop, stopafterPropertiesSet, extractTypeIfPossible, getApplicationContext, getApplicationContextId, getBeanFactory, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetComponentNamepublic static final long DEFAULT_RECEIVE_TIMEOUT
public static final long DEFAULT_RECOVERY_INTERVAL
public RedisQueueInboundGateway(java.lang.String queueName,
org.springframework.data.redis.connection.RedisConnectionFactory connectionFactory)
queueName - Must not be an empty StringconnectionFactory - Must not be nullpublic void setExtractPayload(boolean extractPayload)
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAwarepublic void setSerializer(org.springframework.data.redis.serializer.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: http://redis.io/commands/brpop
receiveTimeout - Must be non-negative. Specified in milliseconds.public void setTaskExecutor(java.util.concurrent.Executor taskExecutor)
public void setRecoveryInterval(long recoveryInterval)
protected void onInit()
throws java.lang.Exception
onInit in class org.springframework.integration.gateway.MessagingGatewaySupportjava.lang.Exceptionpublic java.lang.String getComponentType()
getComponentType in interface org.springframework.integration.support.context.NamedComponentgetComponentType in class org.springframework.integration.gateway.MessagingGatewaySupportprotected void doStart()
doStart in class org.springframework.integration.gateway.MessagingGatewaySupportprotected void doStop(java.lang.Runnable callback)
doStop in class org.springframework.integration.endpoint.AbstractEndpointprotected void doStop()
doStop in class org.springframework.integration.gateway.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 http://redis.io/commands/llen@ManagedOperation public void clearQueue()
boundListOperations.