Class FileAggregator
java.lang.Object
org.springframework.integration.file.aggregator.FileAggregator
- All Implemented Interfaces:
Aware,BeanFactoryAware,CorrelationStrategy,GroupConditionProvider,MessageGroupProcessor,ReleaseStrategy
public class FileAggregator
extends Object
implements CorrelationStrategy, ReleaseStrategy, GroupConditionProvider, MessageGroupProcessor, 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
- Author:
- Artem Bilan
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanRelease(MessageGroup group) getCorrelationKey(Message<?> message) Find the correlation key for the given message.BiFunction<Message<?>, String, String> processMessageGroup(MessageGroup group) Process the given MessageGroup.voidsetBeanFactory(BeanFactory beanFactory)
-
Constructor Details
-
FileAggregator
public FileAggregator()
-
-
Method Details
-
setBeanFactory
- Specified by:
setBeanFactoryin interfaceBeanFactoryAware- Throws:
BeansException
-
getCorrelationKey
Description copied from interface:CorrelationStrategyFind the correlation key for the given message. If no key can be determined the strategy should not returnnull, but throw an exception.- Specified by:
getCorrelationKeyin interfaceCorrelationStrategy- Parameters:
message- The message.- Returns:
- The correlation key.
-
canRelease
- Specified by:
canReleasein interfaceReleaseStrategy
-
getGroupConditionSupplier
- Specified by:
getGroupConditionSupplierin interfaceGroupConditionProvider
-
processMessageGroup
Description copied from interface:MessageGroupProcessorProcess the given MessageGroup. Implementations are free to return as few or as many messages based on the invocation as needed. For example an aggregating processor will return only a single message representing the group, while a resequencing processor will return all messages whose preceding sequence has been satisfied.If a multiple messages are returned the return value must be a Collection<Message>.
- Specified by:
processMessageGroupin interfaceMessageGroupProcessor- Parameters:
group- The message group.- Returns:
- The result of processing the group.
-