Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Autowired
- private IntegrationFlowContext flowContext;
- @PostConstruct
- private void registerFilePollingFlows() {
- configuration.getFiles().forEach(inboundSource -> {
- IntegrationFlow flow = IntegrationFlows.from(s -> s.file(inboundSource.getReadFilePath())
- .preventDuplicates(true).scanEachPoll(true).patternFilter("*.txt"),
- e -> e.poller(Pollers.fixedDelay(inboundSource.getPollingPeriod())
- .taskExecutor(taskExecutor())
- .transactionSynchronizationFactory(transactionSynchronizationFactory(
- inboundSource.getProcessedPath(), inboundSource.getFailedPath()))
- .transactional(transactionManager())))
- .log(LoggingHandler.Level.INFO, getClass().getName(), "'Read inbound file: ' .concat(payload)")
- .enrichHeaders(m -> {
- m.headerExpression(FileHeaders.ORIGINAL_FILE, "payload");
- })
- .transform(Transformers.fileToString())
- .channel(ApplicationConfiguration.FILE_INBOUND_CHANNEL)
- .get();
- flowContext.registration(flow).autoStartup(true).register();
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement