daily pastebin goal
74%
SHARE
TWEET

SI IntegrationFlowContext

a guest Mar 12th, 2018 4 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Autowired
  2.     private IntegrationFlowContext flowContext;
  3.  
  4. @PostConstruct
  5.     private void registerFilePollingFlows() {
  6.         configuration.getFiles().forEach(inboundSource -> {
  7.             IntegrationFlow flow = IntegrationFlows.from(s -> s.file(inboundSource.getReadFilePath())
  8.                             .preventDuplicates(true).scanEachPoll(true).patternFilter("*.txt"),
  9.                             e -> e.poller(Pollers.fixedDelay(inboundSource.getPollingPeriod())
  10.                                     .taskExecutor(taskExecutor())
  11.                                     .transactionSynchronizationFactory(transactionSynchronizationFactory(
  12.                                             inboundSource.getProcessedPath(), inboundSource.getFailedPath()))
  13.                                     .transactional(transactionManager())))
  14.                     .log(LoggingHandler.Level.INFO, getClass().getName(), "'Read inbound file: ' .concat(payload)")
  15.                     .enrichHeaders(m -> {
  16.                         m.headerExpression(FileHeaders.ORIGINAL_FILE, "payload");
  17.                     })
  18.                     .transform(Transformers.fileToString())
  19.                     .channel(ApplicationConfiguration.FILE_INBOUND_CHANNEL)
  20.                     .get();
  21.             flowContext.registration(flow).autoStartup(true).register();
  22.         });
  23.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top