Class FileTailingMessageProducerSupport
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.endpoint.AbstractEndpoint
org.springframework.integration.endpoint.MessageProducerSupport
org.springframework.integration.file.tail.FileTailingMessageProducerSupport
- All Implemented Interfaces:
Aware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, SmartInitializingSingleton, ApplicationContextAware, ApplicationEventPublisherAware, Lifecycle, Phased, SmartLifecycle, ComponentSourceAware, ExpressionCapable, MessageProducer, IntegrationPattern, NamedComponent, IntegrationInboundManagement, IntegrationManagement, ManageableLifecycle, ManageableSmartLifecycle, TrackableComponent
- Direct Known Subclasses:
ApacheCommonsFileTailingMessageProducer, OSDelegatingFileTailingMessageProducer
public abstract class FileTailingMessageProducerSupport
extends MessageProducerSupport
implements ApplicationEventPublisherAware
Base class for file tailing inbound adapters.
- Since:
- 3.0
- Author:
- Gary Russell, Artem Bilan, Ali Shahbour, Vladimir Plizga
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classNested classes/interfaces inherited from interface IntegrationManagement
IntegrationManagement.ManagementOverrides -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longThe default delay between tail attempts in milliseconds.Fields inherited from class AbstractEndpoint
lifecycleLockFields inherited from class IntegrationObjectSupport
EXPRESSION_PARSER, loggerFields inherited from interface IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAMEFields inherited from interface SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoStart()Take no action by default.protected voiddoStop()Take no action by default.protected FilegetFile()protected longprotected TaskExecutorprotected voidprotected voidvoidsetApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) voidThe name of the file you wish to tail.voidsetIdleEventInterval(long idleEventInterval) How often to emitFileTailingMessageProducerSupport.FileTailingIdleEvents in milliseconds.voidsetTailAttemptsDelay(long tailAttemptsDelay) The delay in milliseconds between attempts to tail a non-existent file, or between attempts to execute a process if it fails for any reason.voidsetTaskExecutor(TaskExecutor taskExecutor) A task executor; default is aSimpleAsyncTaskExecutor.Methods inherited from class MessageProducerSupport
afterSingletonsInstantiated, buildErrorMessage, getErrorChannel, getErrorMessageAttributes, getErrorMessageStrategy, getIntegrationPatternType, getMessagingTemplate, getOutputChannel, getOutputChannelName, getRequiredOutputChannel, isObserved, onInit, registerObservationRegistry, sendErrorMessageIfNecessary, sendMessage, setErrorChannel, setErrorChannelName, setErrorMessageStrategy, setObservationConvention, setOutputChannel, setOutputChannelName, setSendTimeout, setShouldTrack, subscribeToPublisherMethods inherited from class AbstractEndpoint
destroy, doStop, getPhase, getRole, isActive, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stopMethods inherited from class IntegrationObjectSupport
afterPropertiesSet, 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 Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface IntegrationManagement
destroy, getManagedName, getManagedType, getOverrides, getThisAs, isLoggingEnabled, registerMetricsCaptor, setLoggingEnabled, setManagedName, setManagedTypeMethods inherited from interface NamedComponent
getBeanName, getComponentNameMethods inherited from interface SmartLifecycle
isPauseable
-
Field Details
-
DEFAULT_TAIL_ATTEMPTS_DELAY
public static final long DEFAULT_TAIL_ATTEMPTS_DELAYThe default delay between tail attempts in milliseconds.- See Also:
-
-
Constructor Details
-
FileTailingMessageProducerSupport
public FileTailingMessageProducerSupport()
-
-
Method Details
-
setApplicationEventPublisher
- Specified by:
setApplicationEventPublisherin interfaceApplicationEventPublisherAware
-
setFile
The name of the file you wish to tail.- Parameters:
file- The absolute path of the file.
-
getFile
-
setTaskExecutor
A task executor; default is aSimpleAsyncTaskExecutor.- Parameters:
taskExecutor- The task executor.
-
setTailAttemptsDelay
public void setTailAttemptsDelay(long tailAttemptsDelay) The delay in milliseconds between attempts to tail a non-existent file, or between attempts to execute a process if it fails for any reason.- Parameters:
tailAttemptsDelay- the delay.
-
setIdleEventInterval
public void setIdleEventInterval(long idleEventInterval) How often to emitFileTailingMessageProducerSupport.FileTailingIdleEvents in milliseconds.- Parameters:
idleEventInterval- the interval.- Since:
- 5.0
-
getMissingFileDelay
protected long getMissingFileDelay() -
getTaskExecutor
-
getComponentType
- Specified by:
getComponentTypein interfaceNamedComponent- Overrides:
getComponentTypein classMessageProducerSupport
-
send
-
publish
-
doStart
protected void doStart()Description copied from class:MessageProducerSupportTake no action by default. Subclasses may override this if they need lifecycle-managed behavior. Protected by 'lifecycleLock'.- Overrides:
doStartin classMessageProducerSupport
-
doStop
protected void doStop()Description copied from class:MessageProducerSupportTake no action by default. Subclasses may override this if they need lifecycle-managed behavior.- Overrides:
doStopin classMessageProducerSupport
-