/** * Configure a {@link SimplePatternFileListFilter}. * @param pattern The pattern. * @param preventDuplicates the preventDuplicates. * @return the spec. * @see FileReadingMessageSource#setFilter(FileListFilter) * @see #filter(FileListFilter, boolean) * @see #preventDuplicates * @deprecated since 1.1 in favor of the bunch of methods usage. */ @Deprecated public FileInboundChannelAdapterSpec patternFilter(String pattern, boolean preventDuplicates) { return patternFilter(pattern) .preventDuplicates(preventDuplicates); }
public static FileInboundChannelAdapterSpec inboundAdapter(File directory, Comparator<File> receptionOrderComparator) { return new FileInboundChannelAdapterSpec(receptionOrderComparator).directory(directory); }
/** * Configure a {@link RegexPatternFileListFilter}. * @param regex The regex. * @return the spec. * @see FileReadingMessageSource#setFilter(FileListFilter) * @see #filter(FileListFilter, boolean) */ public FileInboundChannelAdapterSpec regexFilter(String regex) { this.fileListFilterFactoryBean.setFilenameRegex(regex); this.filtersSet = true; return _this(); }
/** * Configure the filter; if {@code preventDuplicates == true}, the filter is combined with an * {@link AcceptOnceFileListFilter} in a {@link CompositeFileListFilter}. * @param filter the filter. * @param preventDuplicates true to prevent duplicates. * @return the spec. * @see CompositeFileListFilter * @see AcceptOnceFileListFilter * @deprecated since 1.1 in favor of the bunch of methods usage. */ @Deprecated public FileInboundChannelAdapterSpec filter(FileListFilter<File> filter, boolean preventDuplicates) { return filter(filter) .preventDuplicates(preventDuplicates); }
@Bean public IntegrationFlow fileReadingFlow() { return IntegrationFlows .from(s -> s.file(tmpDir.getRoot()) .patternFilter("*.sitest") .useWatchService(true) .watchEvents(FileReadingMessageSource.WatchEventType.CREATE, FileReadingMessageSource.WatchEventType.MODIFY), e -> e.poller(Pollers.fixedDelay(100) .errorChannel("filePollingErrorChannel"))) .filter(File.class, p -> !p.getName().startsWith("a"), e -> e.throwExceptionOnRejection(true)) .transform(Transformers.fileToString()) .aggregate(a -> a.correlationExpression("1") .releaseStrategy(g -> g.size() == 25)) .channel(MessageChannels.queue("fileReadingResultChannel")) .get(); }
@Bean public IntegrationFlow fileToFile() { return IntegrationFlows.from(Files.inboundAdapter(new File("/tmp/in")) .autoCreateDirectory(true) .patternFilter("*.txt"), e -> e.poller(Pollers.fixedDelay(5000))) .transform(Transformers.fileToString()) .transform("payload.replaceAll('\r\n', '\n')") .handle(Files.outboundAdapter("'/tmp/out'") .autoCreateDirectory(true)) .get(); }
/** * Configure a {@link RegexPatternFileListFilter}. * @param regex The regex. * @param preventDuplicates the preventDuplicates. * @return the spec. * @see FileReadingMessageSource#setFilter(FileListFilter) * @see #filter(FileListFilter, boolean) * @see #preventDuplicates * @deprecated since 1.1 in favor of the bunch of methods usage. */ @Deprecated public FileInboundChannelAdapterSpec regexFilter(String regex, boolean preventDuplicates) { return regexFilter(regex) .preventDuplicates(preventDuplicates); }
/** * Configure an {@link AcceptOnceFileListFilter}. * @return the spec. * @since 1.1 * @deprecated since 1.1.3 in favor of {@link #preventDuplicates(boolean)} */ @Deprecated public FileInboundChannelAdapterSpec preventDuplicates() { return filter(new AcceptOnceFileListFilter<File>()); }
@Bean public IntegrationFlow fileSplitterFlow() { return IntegrationFlows .from(s -> s.file(tmpDir.getRoot()) .patternFilter("foo.tmp"), e -> e.poller(p -> p.fixedDelay(100))) .split(Files.splitter() .markers() .charset(StandardCharsets.US_ASCII) .applySequence(true), e -> e.id("fileSplitter")) .channel(c -> c.queue("fileSplittingResultChannel")) .get(); }
/** * Configure an {@link NioFileLocker}. * @return the spec. * @see #locker(FileLocker) */ public FileInboundChannelAdapterSpec nioLocker() { return locker(new NioFileLocker()); }
/** * Configure an {@link AcceptOnceFileListFilter} if {@code preventDuplicates == true}, * otherwise nothing changed. * @param preventDuplicates true to configure an {@link AcceptOnceFileListFilter}. * @return the spec. * @see #preventDuplicates * @deprecated since 1.1 in favor of the bunch of methods usage. */ @Deprecated public FileInboundChannelAdapterSpec preventDuplicatesFilter(boolean preventDuplicates) { return preventDuplicates(preventDuplicates); }
@Bean public IntegrationFlow fileToFile() { return IntegrationFlows.from(Files.inboundAdapter(new File("/tmp/in")) .autoCreateDirectory(true) .patternFilter("*.txt"), e -> e.poller(Pollers.fixedDelay(5000))) .transform(Transformers.fileToString()) .transform("payload.replaceAll('\r\n', '\n')") .publishSubscribeChannel(c -> c .subscribe(s -> s.handle(Files.outboundAdapter("'/tmp/out'") .autoCreateDirectory(true))) .subscribe(s -> s.log(LoggingHandler.Level.WARN, null, "headers['file_originalFile'].absolutePath + ' transferred'"))) .get(); }
/** * Configure the filter; if {@code preventDuplicates == true}, the filter is combined with an * {@link AcceptOnceFileListFilter} in a {@link CompositeFileListFilter}. * @param filter the filter. * @param preventDuplicates true to prevent duplicates. * @return the spec. * @see CompositeFileListFilter * @see AcceptOnceFileListFilter * @deprecated since 1.1 in favor of the bunch of methods usage. */ @Deprecated public FileInboundChannelAdapterSpec filter(FileListFilter<File> filter, boolean preventDuplicates) { return filter(filter) .preventDuplicates(preventDuplicates); }
/** * Configure a {@link RegexPatternFileListFilter}. * @param regex The regex. * @param preventDuplicates the preventDuplicates. * @return the spec. * @see FileReadingMessageSource#setFilter(FileListFilter) * @see #filter(FileListFilter, boolean) * @see #preventDuplicates * @deprecated since 1.1 in favor of the bunch of methods usage. */ @Deprecated public FileInboundChannelAdapterSpec regexFilter(String regex, boolean preventDuplicates) { return regexFilter(regex) .preventDuplicates(preventDuplicates); }
/** * Configure an {@link IgnoreHiddenFileListFilter}. * @return the spec. * @since 1.1 * @deprecated since 1.1.3 in favor of {@link #ignoreHidden(boolean)} */ @Deprecated public FileInboundChannelAdapterSpec ignoreHidden() { return filter(new IgnoreHiddenFileListFilter()); }
/** * Configure an {@link NioFileLocker}. * @return the spec. * @see #locker(FileLocker) */ public FileInboundChannelAdapterSpec nioLocker() { return locker(new NioFileLocker()); }
/** * Configure an {@link AcceptOnceFileListFilter} if {@code preventDuplicates == true}, * otherwise nothing changed. * @param preventDuplicates true to configure an {@link AcceptOnceFileListFilter}. * @return the spec. * @see #preventDuplicates * @deprecated since 1.1 in favor of the bunch of methods usage. */ @Deprecated public FileInboundChannelAdapterSpec preventDuplicatesFilter(boolean preventDuplicates) { return preventDuplicates(preventDuplicates); }
/** * @param directory the directory. * @return the spec. * @see FileReadingMessageSource#setDirectory(File) */ FileInboundChannelAdapterSpec directory(File directory) { this.target.setDirectory(directory); return _this(); }
/** * Configure a {@link SimplePatternFileListFilter}. * @param pattern The pattern. * @param preventDuplicates the preventDuplicates. * @return the spec. * @see FileReadingMessageSource#setFilter(FileListFilter) * @see #filter(FileListFilter, boolean) * @see #preventDuplicates * @deprecated since 1.1 in favor of the bunch of methods usage. */ @Deprecated public FileInboundChannelAdapterSpec patternFilter(String pattern, boolean preventDuplicates) { return patternFilter(pattern) .preventDuplicates(preventDuplicates); }
@Bean public IntegrationFlow fileSplitterAggregator() { return IntegrationFlows .from(Files.inboundAdapter(new File("/tmp/in")) .autoCreateDirectory(true) .patternFilter("*.txt"), e -> e.poller(Pollers.fixedDelay(5000))) .split(Files.splitter() .markers() .applySequence(true)) .filter(p -> !(p instanceof FileSplitter.FileMarker), e -> e.discardChannel("aggregatorChannel")) .<String, Name>transform(Name::new) .<Name>filter(p -> !p.getValue().startsWith("X")) .channel("aggregatorChannel") .aggregate(a -> a.processor(new FileMarkerAggregator())) .<List<Name>, Names>transform(Names::new) .transform(Transformers.marshaller(jaxbMarshaller(), new ResultToStringTransformer())) .handle(Files.outboundAdapter("'/tmp/out'") .fileNameGenerator(m -> m .getHeaders() .get(FileHeaders.FILENAME, String.class) .replace(".txt", ".xml")) .autoCreateDirectory(true)) .get(); }