Class FileTailingMessageProducerSupport

All Implemented Interfaces:
Aware, BeanFactoryAware, BeanNameAware, DisposableBean, InitializingBean, SmartInitializingSingleton, ApplicationContextAware, ApplicationEventPublisherAware, Lifecycle, Phased, SmartLifecycle, 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
  • Field Details

    • DEFAULT_TAIL_ATTEMPTS_DELAY

      public static final long DEFAULT_TAIL_ATTEMPTS_DELAY
      The default delay between tail attempts in milliseconds.
      See Also:
  • Constructor Details

    • FileTailingMessageProducerSupport

      public FileTailingMessageProducerSupport()
  • Method Details

    • setApplicationEventPublisher

      public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
      Specified by:
      setApplicationEventPublisher in interface ApplicationEventPublisherAware
    • setFile

      public void setFile(File file)
      The name of the file you wish to tail.
      Parameters:
      file - The absolute path of the file.
    • getFile

      protected File getFile()
    • setTaskExecutor

      public void setTaskExecutor(TaskExecutor taskExecutor)
      A task executor; default is a SimpleAsyncTaskExecutor.
      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 emit FileTailingMessageProducerSupport.FileTailingIdleEvents in milliseconds.
      Parameters:
      idleEventInterval - the interval.
      Since:
      5.0
    • getMissingFileDelay

      protected long getMissingFileDelay()
    • getTaskExecutor

      protected TaskExecutor getTaskExecutor()
    • getComponentType

      public String getComponentType()
      Description copied from class: IntegrationObjectSupport
      Subclasses may implement this method to provide component type information.
      Specified by:
      getComponentType in interface NamedComponent
      Overrides:
      getComponentType in class IntegrationObjectSupport
    • send

      protected void send(String line)
    • publish

      protected void publish(String message)
    • doStart

      protected void doStart()
      Description copied from class: MessageProducerSupport
      Take no action by default. Subclasses may override this if they need lifecycle-managed behavior. Protected by 'lifecycleLock'.
      Overrides:
      doStart in class MessageProducerSupport
    • doStop

      protected void doStop()
      Description copied from class: MessageProducerSupport
      Take no action by default. Subclasses may override this if they need lifecycle-managed behavior.
      Overrides:
      doStop in class MessageProducerSupport