Class RedisQueueInboundGateway
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.endpoint.AbstractEndpoint
org.springframework.integration.gateway.MessagingGatewaySupport
org.springframework.integration.redis.inbound.RedisQueueInboundGateway
- All Implemented Interfaces:
- Aware,- BeanClassLoaderAware,- BeanFactoryAware,- BeanNameAware,- DisposableBean,- InitializingBean,- ApplicationContextAware,- ApplicationEventPublisherAware,- Lifecycle,- Phased,- SmartLifecycle,- ExpressionCapable,- IntegrationPattern,- NamedComponent,- IntegrationInboundManagement,- IntegrationManagement,- ManageableLifecycle,- ManageableSmartLifecycle,- TrackableComponent
@ManagedResource
@IntegrationManagedResource
public class RedisQueueInboundGateway
extends MessagingGatewaySupport
implements ApplicationEventPublisherAware, BeanClassLoaderAware
- Since:
- 4.1
- Author:
- David Liu, Artem Bilan, Gary Russell, Matthias Jeschke
- 
Nested Class SummaryNested classes/interfaces inherited from class org.springframework.integration.gateway.MessagingGatewaySupportMessagingGatewaySupport.ConvertingMessagingTemplateNested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagementIntegrationManagement.ManagementOverrides
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final longstatic final longFields inherited from class org.springframework.integration.gateway.MessagingGatewaySupportmessagingTemplateFields inherited from class org.springframework.integration.endpoint.AbstractEndpointlifecycleCondition, lifecycleLockFields inherited from class org.springframework.integration.context.IntegrationObjectSupportEXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagementMETER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface org.springframework.context.SmartLifecycleDEFAULT_PHASE
- 
Constructor SummaryConstructorsConstructorDescriptionRedisQueueInboundGateway(String queueName, RedisConnectionFactory connectionFactory) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidClear the Redis Queue specified byboundListOperations.protected voiddoStart()Subclasses must implement this method with the start behavior.protected voiddoStop()Subclasses must implement this method with the stop behavior.protected voidStop the component and invoke callback.Subclasses may implement this method to provide component type information.longReturns the size of the Queue specified byboundListOperations.booleanprotected voidonInit()Subclasses may implement this for initialization logic.voidsetApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) voidsetBeanClassLoader(ClassLoader beanClassLoader) voidsetExtractPayload(boolean extractPayload) voidsetReceiveTimeout(long receiveTimeout) This timeout (milliseconds) is used when retrieving elements from the queue specified byboundListOperations.voidsetRecoveryInterval(long recoveryInterval) voidsetSerializer(RedisSerializer<?> serializer) voidsetTaskExecutor(Executor taskExecutor) Methods inherited from class org.springframework.integration.gateway.MessagingGatewaySupportbuildErrorMessage, buildSendTimer, destroy, getErrorChannel, getErrorMessageAttributes, getErrorMessageStrategy, getIntegrationPatternType, getManagedName, getManagedType, getOverrides, getReplyChannel, getRequestChannel, isLoggingEnabled, isObserved, receive, receive, receiveMessage, receiveMessage, registerMetricsCaptor, registerObservationRegistry, registerReplyMessageCorrelatorIfNecessary, send, sendAndReceive, sendAndReceiveMessage, sendAndReceiveMessageReactive, sendTimer, setErrorChannel, setErrorChannelName, setErrorMessageStrategy, setErrorOnTimeout, setLoggingEnabled, setManagedName, setManagedType, setObservationConvention, setReceiverObservationConvention, setReplyChannel, setReplyChannelName, setReplyMapper, setReplyTimeout, setRequestChannel, setRequestChannelName, setRequestMapper, setRequestTimeout, setShouldTrackMethods inherited from class org.springframework.integration.endpoint.AbstractEndpointgetPhase, getRole, isActive, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stopMethods inherited from class org.springframework.integration.context.IntegrationObjectSupportafterPropertiesSet, 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, toStringMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.integration.support.management.IntegrationManagementgetThisAsMethods inherited from interface org.springframework.integration.support.context.NamedComponentgetBeanName, getComponentName
- 
Field Details- 
DEFAULT_RECEIVE_TIMEOUTpublic static final long DEFAULT_RECEIVE_TIMEOUT- See Also:
 
- 
DEFAULT_RECOVERY_INTERVALpublic static final long DEFAULT_RECOVERY_INTERVAL- See Also:
 
 
- 
- 
Constructor Details- 
RedisQueueInboundGateway- Parameters:
- queueName- Must not be an empty String
- connectionFactory- Must not be null
 
 
- 
- 
Method Details- 
setExtractPayloadpublic void setExtractPayload(boolean extractPayload) 
- 
setApplicationEventPublisher- Specified by:
- setApplicationEventPublisherin interface- ApplicationEventPublisherAware
 
- 
setBeanClassLoader- Specified by:
- setBeanClassLoaderin interface- BeanClassLoaderAware
 
- 
setSerializer
- 
setReceiveTimeoutpublic void setReceiveTimeout(long receiveTimeout) This timeout (milliseconds) is used when retrieving elements from the queue specified byboundListOperations.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 1000See also: https://redis.io/commands/brpop - Parameters:
- receiveTimeout- Must be non-negative. Specified in milliseconds.
 
- 
setTaskExecutor
- 
setRecoveryIntervalpublic void setRecoveryInterval(long recoveryInterval) 
- 
onInitprotected void onInit()Description copied from class:IntegrationObjectSupportSubclasses may implement this for initialization logic.- Overrides:
- onInitin class- MessagingGatewaySupport
 
- 
getComponentTypeDescription copied from class:IntegrationObjectSupportSubclasses may implement this method to provide component type information.- Specified by:
- getComponentTypein interface- NamedComponent
- Overrides:
- getComponentTypein class- MessagingGatewaySupport
 
- 
doStartprotected void doStart()Description copied from class:AbstractEndpointSubclasses must implement this method with the start behavior. This method will be invoked while holding theAbstractEndpoint.lifecycleLock.- Overrides:
- doStartin class- MessagingGatewaySupport
 
- 
doStopDescription copied from class:AbstractEndpointStop the component and invoke callback.- Overrides:
- doStopin class- AbstractEndpoint
- Parameters:
- callback- the Runnable to invoke.
 
- 
doStopprotected void doStop()Description copied from class:AbstractEndpointSubclasses must implement this method with the stop behavior. This method will be invoked while holding theAbstractEndpoint.lifecycleLock.- Overrides:
- doStopin class- MessagingGatewaySupport
 
- 
isListeningpublic boolean isListening()
- 
getQueueSizeReturns the size of the Queue specified byboundListOperations. The queue is represented by a Redis list. If the queue does not exist0is returned. See also https://redis.io/commands/llen- Returns:
- Size of the queue. Never negative.
 
- 
clearQueueClear the Redis Queue specified byboundListOperations.
 
-