Class SourcePollingChannelAdapter
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.endpoint.AbstractEndpoint
org.springframework.integration.endpoint.AbstractPollingEndpoint
org.springframework.integration.endpoint.SourcePollingChannelAdapter
- All Implemented Interfaces:
- Aware,- BeanClassLoaderAware,- BeanFactoryAware,- BeanNameAware,- DisposableBean,- InitializingBean,- ApplicationContextAware,- Lifecycle,- Phased,- SmartLifecycle,- ComponentSourceAware,- ExpressionCapable,- NamedComponent,- IntegrationManagement,- ManageableLifecycle,- ManageableSmartLifecycle,- TrackableComponent
public class SourcePollingChannelAdapter
extends AbstractPollingEndpoint
implements TrackableComponent, IntegrationManagement
A Channel Adapter implementation for connecting a 
MessageSource to a MessageChannel.- Author:
- Mark Fisher, Oleg Zhurakousky, Gary Russell, Artem Bilan, Christian Tzolov
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagementIntegrationManagement.ManagementOverrides
- 
Field SummaryFields inherited from class org.springframework.integration.endpoint.AbstractPollingEndpointDEFAULT_POLLING_PERIODFields 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 SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voiddonePollingTask(Exception pollingTaskError) Stop an observation (and close its scope) previously started from themessageReceived(IntegrationResourceHolder, Message).protected voiddoStart()Subclasses must implement this method with the start behavior.protected voiddoStop()Subclasses must implement this method with the stop behavior.Subclasses may implement this method to provide component type information.Return this endpoint's source.protected Objectprotected StringReturn the key under which the resource will be made available as an attribute on theIntegrationResourceHolder.protected ObjectReturn a resource (MessageSource etc.) to bind when using transaction synchronization.protected voidhandleMessage(Message<?> messageArg) Handle a message.booleanTrue if this implementation is going to deal with a registry other than theObservationRegistry.NOOPinstance.protected booleanprotected voidmessageReceived(IntegrationResourceHolder holder, Message<?> message) Start an observation (and open scope) for the received message.protected voidonInit()Subclasses may implement this for initialization logic.protected Message<?>Obtain the next message (if one is available).voidregisterObservationRegistry(io.micrometer.observation.ObservationRegistry observationRegistry) Inject anObservationRegistry.voidsetObservationConvention(MessageReceiverObservationConvention observationConvention) Set a customMessageReceiverObservationConventionforIntegrationObservation.HANDLER.voidsetOutputChannel(MessageChannel outputChannel) Specify theMessageChannelwhere Messages should be sent.voidsetOutputChannelName(String outputChannelName) protected final voidsetReceiveMessageSource(Object source) voidsetSendTimeout(long sendTimeout) Specify the maximum time to wait for a Message to be sent to the output channel.voidsetShouldTrack(boolean shouldTrack) Specify whether this component should be tracked in the Message History.voidsetSource(MessageSource<?> source) Specify the source to be polled for Messages.Methods inherited from class org.springframework.integration.endpoint.AbstractPollingEndpointapplyReceiveOnlyAdviceChain, getBeanClassLoader, getDefaultErrorChannel, getMaxMessagesPerPoll, getPollingFlux, getTaskExecutor, isReceiveOnlyAdvice, isSyncExecutor, setAdviceChain, setBeanClassLoader, setErrorHandler, setMaxMessagesPerPoll, setTaskExecutor, setTransactionSynchronizationFactory, setTriggerMethods inherited from class org.springframework.integration.endpoint.AbstractEndpointdestroy, doStop, getPhase, 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, getComponentDescription, getComponentName, getComponentSource, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentDescription, setComponentName, setComponentSource, 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.IntegrationManagementdestroy, getManagedName, getManagedType, getOverrides, getThisAs, isLoggingEnabled, registerMetricsCaptor, setLoggingEnabled, setManagedName, setManagedTypeMethods inherited from interface org.springframework.integration.support.context.NamedComponentgetBeanName, getComponentName
- 
Constructor Details- 
SourcePollingChannelAdapterpublic SourcePollingChannelAdapter()
 
- 
- 
Method Details- 
setSourceSpecify the source to be polled for Messages.- Parameters:
- source- The message source.
 
- 
setOutputChannelSpecify theMessageChannelwhere Messages should be sent.- Parameters:
- outputChannel- The output channel.
 
- 
getMessageSourceReturn this endpoint's source.- Returns:
- the source.
- Since:
- 4.3
 
- 
setOutputChannelName
- 
setSendTimeoutpublic void setSendTimeout(long sendTimeout) Specify the maximum time to wait for a Message to be sent to the output channel.- Parameters:
- sendTimeout- The send timeout.
 
- 
setShouldTrackpublic void setShouldTrack(boolean shouldTrack) Specify whether this component should be tracked in the Message History.- Specified by:
- setShouldTrackin interface- TrackableComponent
- Parameters:
- shouldTrack- true if the component should be tracked.
 
- 
registerObservationRegistrypublic void registerObservationRegistry(io.micrometer.observation.ObservationRegistry observationRegistry) Description copied from interface:IntegrationManagementInject anObservationRegistry. If provided, theMetricsCaptoris ignored. The meters capturing has to be configured as anObservationHandleron the providedObservationRegistry.- Specified by:
- registerObservationRegistryin interface- IntegrationManagement
- Parameters:
- observationRegistry- the- ObservationRegistryto expose observations from the component.
- See Also:
 
- 
setObservationConventionpublic void setObservationConvention(@Nullable MessageReceiverObservationConvention observationConvention) Set a customMessageReceiverObservationConventionforIntegrationObservation.HANDLER. Ignored if anObservationRegistryis not configured for this component.- Parameters:
- observationConvention- the- MessageReceiverObservationConventionto use.
- Since:
- 6.5
 
- 
isObservedpublic boolean isObserved()Description copied from interface:IntegrationManagementTrue if this implementation is going to deal with a registry other than theObservationRegistry.NOOPinstance.- Specified by:
- isObservedin interface- IntegrationManagement
- Returns:
- true if this implementation is going to deal with a registry other than the ObservationRegistry.NOOPinstance.
 
- 
getComponentTypeDescription copied from class:IntegrationObjectSupportSubclasses may implement this method to provide component type information.- Specified by:
- getComponentTypein interface- NamedComponent
- Overrides:
- getComponentTypein class- IntegrationObjectSupport
 
- 
isReactiveprotected boolean isReactive()- Overrides:
- isReactivein class- AbstractPollingEndpoint
 
- 
getReceiveMessageSource- Overrides:
- getReceiveMessageSourcein class- AbstractPollingEndpoint
 
- 
setReceiveMessageSource- Overrides:
- setReceiveMessageSourcein class- AbstractPollingEndpoint
 
- 
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- AbstractPollingEndpoint
 
- 
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- AbstractPollingEndpoint
 
- 
onInitprotected void onInit()Description copied from class:IntegrationObjectSupportSubclasses may implement this for initialization logic.- Overrides:
- onInitin class- AbstractPollingEndpoint
 
- 
getOutputChannel
- 
handleMessageDescription copied from class:AbstractPollingEndpointHandle a message.- Specified by:
- handleMessagein class- AbstractPollingEndpoint
- Parameters:
- messageArg- The message.
 
- 
receiveMessageDescription copied from class:AbstractPollingEndpointObtain the next message (if one is available). MAY return null if no message is immediately available.- Specified by:
- receiveMessagein class- AbstractPollingEndpoint
- Returns:
- The message or null.
 
- 
messageReceivedStart an observation (and open scope) for the received message.- Overrides:
- messageReceivedin class- AbstractPollingEndpoint
- Parameters:
- holder- the resource holder for this component.
- message- the received message.
 
- 
donePollingTaskStop an observation (and close its scope) previously started from themessageReceived(IntegrationResourceHolder, Message).- Overrides:
- donePollingTaskin class- AbstractPollingEndpoint
- Parameters:
- pollingTaskError- an optional error as a result of the polling task.
 
- 
getResourceToBindDescription copied from class:AbstractPollingEndpointReturn a resource (MessageSource etc.) to bind when using transaction synchronization.- Overrides:
- getResourceToBindin class- AbstractPollingEndpoint
- Returns:
- The resource, or null if transaction synchronization is not required.
 
- 
getResourceKeyDescription copied from class:AbstractPollingEndpointReturn the key under which the resource will be made available as an attribute on theIntegrationResourceHolder. The defaultExpressionEvaluatingTransactionSynchronizationProcessormakes this attribute available as a variable in SpEL expressions.- Overrides:
- getResourceKeyin class- AbstractPollingEndpoint
- Returns:
- The key, or null (default) if the resource shouldn't be made available as a attribute.
 
 
-