Class DefaultPollableMessageSource
java.lang.Object
org.springframework.cloud.stream.binder.DefaultPollableMessageSource
- All Implemented Interfaces:
PollableMessageSource, PollableSource<org.springframework.messaging.MessageHandler>, org.springframework.context.Lifecycle
public class DefaultPollableMessageSource
extends Object
implements PollableMessageSource, org.springframework.context.Lifecycle
The default implementation of a
PollableMessageSource.- Since:
- 2.0
- Author:
- Gary Russell, Oleg Zhurakousky, David Turanski, Byungjun You
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final ThreadLocal<org.springframework.core.AttributeAccessor> -
Constructor Summary
ConstructorsConstructorDescriptionDefaultPollableMessageSource(org.springframework.messaging.converter.SmartMessageConverter messageConverter) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInterceptor(int index, org.springframework.messaging.support.ChannelInterceptor interceptor) voidaddInterceptor(org.springframework.messaging.support.ChannelInterceptor interceptor) booleanbooleanpoll(org.springframework.messaging.MessageHandler handler) Poll the consumer.booleanpoll(org.springframework.messaging.MessageHandler handler, org.springframework.core.ParameterizedTypeReference<?> type) Poll the consumer and convert the payload to the type.voidsetAttributesProvider(BiConsumer<org.springframework.core.AttributeAccessor, org.springframework.messaging.Message<?>> attributesProvider) voidsetErrorChannel(org.springframework.messaging.MessageChannel errorChannel) voidsetErrorMessageStrategy(org.springframework.integration.support.ErrorMessageStrategy errorMessageStrategy) voidsetRecoveryCallback(org.springframework.integration.core.RecoveryCallback<Object> recoveryCallback) voidsetRetryTemplate(org.springframework.core.retry.RetryTemplate retryTemplate) voidsetSource(org.springframework.integration.core.MessageSource<?> source) protected booleanvoidstart()voidstop()
-
Field Details
-
ATTRIBUTES_HOLDER
-
-
Constructor Details
-
DefaultPollableMessageSource
public DefaultPollableMessageSource(@Nullable org.springframework.messaging.converter.SmartMessageConverter messageConverter) - Parameters:
messageConverter- instance ofSmartMessageConverter. Can be null.
-
-
Method Details
-
setSource
public void setSource(org.springframework.integration.core.MessageSource<?> source) -
setRetryTemplate
public void setRetryTemplate(org.springframework.core.retry.RetryTemplate retryTemplate) -
setRecoveryCallback
public void setRecoveryCallback(org.springframework.integration.core.RecoveryCallback<Object> recoveryCallback) -
setErrorChannel
public void setErrorChannel(org.springframework.messaging.MessageChannel errorChannel) -
setErrorMessageStrategy
public void setErrorMessageStrategy(org.springframework.integration.support.ErrorMessageStrategy errorMessageStrategy) -
setAttributesProvider
public void setAttributesProvider(BiConsumer<org.springframework.core.AttributeAccessor, org.springframework.messaging.Message<?>> attributesProvider) -
addInterceptor
public void addInterceptor(org.springframework.messaging.support.ChannelInterceptor interceptor) -
addInterceptor
public void addInterceptor(int index, org.springframework.messaging.support.ChannelInterceptor interceptor) -
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceorg.springframework.context.Lifecycle
-
start
public void start()- Specified by:
startin interfaceorg.springframework.context.Lifecycle
-
stop
public void stop()- Specified by:
stopin interfaceorg.springframework.context.Lifecycle
-
poll
public boolean poll(org.springframework.messaging.MessageHandler handler) Description copied from interface:PollableSourcePoll the consumer.- Specified by:
pollin interfacePollableSource<org.springframework.messaging.MessageHandler>- Parameters:
handler- the handler.- Returns:
- true if a message was handled.
-
poll
public boolean poll(org.springframework.messaging.MessageHandler handler, org.springframework.core.ParameterizedTypeReference<?> type) Description copied from interface:PollableSourcePoll the consumer and convert the payload to the type. Throw aRequeueCurrentMessageExceptionto force the current message to be requeued in the broker (after retries are exhausted, if configured).- Specified by:
pollin interfacePollableSource<org.springframework.messaging.MessageHandler>- Parameters:
handler- the handler.type- the type.- Returns:
- true if a message was handled.
-
shouldRequeue
-