Module spring.cloud.stream
Class DefaultPollableMessageSource
java.lang.Object
org.springframework.cloud.stream.binder.DefaultPollableMessageSource
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.DisposableBean,PollableMessageSource,PollableSource<org.springframework.messaging.MessageHandler>,org.springframework.context.Lifecycle,org.springframework.integration.support.context.NamedComponent,org.springframework.integration.support.management.IntegrationManagement
public class DefaultPollableMessageSource
extends Object
implements PollableMessageSource, org.springframework.context.Lifecycle, org.springframework.integration.support.management.IntegrationManagement, org.springframework.beans.factory.BeanNameAware
The default implementation of a
PollableMessageSource.- Since:
- 2.0
- Author:
- Gary Russell, Oleg Zhurakousky, David Turanski, Byungjun You
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
org.springframework.integration.support.management.IntegrationManagement.ManagementOverrides -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final ThreadLocal<org.springframework.core.AttributeAccessor>Fields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME -
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) voiddestroy()booleanbooleanbooleanpoll(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.voidregisterMetricsCaptor(org.springframework.integration.support.management.metrics.MetricsCaptor captor) voidregisterObservationRegistry(io.micrometer.observation.ObservationRegistry registry) voidsetAttributesProvider(BiConsumer<org.springframework.core.AttributeAccessor, org.springframework.messaging.Message<?>> attributesProvider) voidsetBeanName(String name) 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()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.integration.support.management.IntegrationManagement
getManagedName, getManagedType, getOverrides, getThisAs, isLoggingEnabled, setLoggingEnabled, setManagedName, setManagedTypeMethods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName
-
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
-
setBeanName
- Specified by:
setBeanNamein interfaceorg.springframework.beans.factory.BeanNameAware
-
getComponentName
- Specified by:
getComponentNamein interfaceorg.springframework.integration.support.context.NamedComponent
-
getComponentType
- Specified by:
getComponentTypein interfaceorg.springframework.integration.support.context.NamedComponent
-
registerMetricsCaptor
public void registerMetricsCaptor(org.springframework.integration.support.management.metrics.MetricsCaptor captor) - Specified by:
registerMetricsCaptorin interfaceorg.springframework.integration.support.management.IntegrationManagement
-
registerObservationRegistry
public void registerObservationRegistry(io.micrometer.observation.ObservationRegistry registry) - Specified by:
registerObservationRegistryin interfaceorg.springframework.integration.support.management.IntegrationManagement
-
isObserved
public boolean isObserved()- Specified by:
isObservedin interfaceorg.springframework.integration.support.management.IntegrationManagement
-
destroy
public void destroy()- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean- Specified by:
destroyin interfaceorg.springframework.integration.support.management.IntegrationManagement
-
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
-