Class FileAggregator

java.lang.Object
org.springframework.integration.file.aggregator.FileAggregator
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.integration.aggregator.CorrelationStrategy, org.springframework.integration.aggregator.GroupConditionProvider, org.springframework.integration.aggregator.MessageGroupProcessor, org.springframework.integration.aggregator.ReleaseStrategy

public class FileAggregator extends Object implements org.springframework.integration.aggregator.CorrelationStrategy, org.springframework.integration.aggregator.ReleaseStrategy, org.springframework.integration.aggregator.GroupConditionProvider, org.springframework.integration.aggregator.MessageGroupProcessor, org.springframework.beans.factory.BeanFactoryAware
A convenient component to utilize a FileSplitter.FileMarker-based aggregation logic. Implements all three CorrelationStrategy, ReleaseStrategy and MessageGroupProcessor for runtime optimization. Delegates to HeaderAttributeCorrelationStrategy with FileHeaders.FILENAME attribute, FileMarkerReleaseStrategy and FileAggregatingMessageGroupProcessor, respectively.

The default FileSplitter behavior with markers enabled is about do not provide a sequence details headers, therefore correlation in this aggregator implementation is done by the FileHeaders.FILENAME header which is still populated by the FileSplitter for each line emitted, including FileSplitter.FileMarker messages.

If default behavior of this component does not satisfy the target logic, it is recommended to configure an aggregator with individual strategies.

Since:
5.5
  • Constructor Details

    • FileAggregator

      public FileAggregator()
  • Method Details

    • setBeanFactory

      public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) throws org.springframework.beans.BeansException
      Specified by:
      setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
      Throws:
      org.springframework.beans.BeansException
    • getCorrelationKey

      public Object getCorrelationKey(org.springframework.messaging.Message<?> message)
      Specified by:
      getCorrelationKey in interface org.springframework.integration.aggregator.CorrelationStrategy
    • canRelease

      public boolean canRelease(org.springframework.integration.store.MessageGroup group)
      Specified by:
      canRelease in interface org.springframework.integration.aggregator.ReleaseStrategy
    • getGroupConditionSupplier

      public BiFunction<org.springframework.messaging.Message<?>,String,String> getGroupConditionSupplier()
      Specified by:
      getGroupConditionSupplier in interface org.springframework.integration.aggregator.GroupConditionProvider
    • processMessageGroup

      public Object processMessageGroup(org.springframework.integration.store.MessageGroup group)
      Specified by:
      processMessageGroup in interface org.springframework.integration.aggregator.MessageGroupProcessor