当前位置: 首页>>代码示例>>Java>>正文


Java Files类代码示例

本文整理汇总了Java中org.springframework.integration.dsl.file.Files的典型用法代码示例。如果您正苦于以下问题:Java Files类的具体用法?Java Files怎么用?Java Files使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Files类属于org.springframework.integration.dsl.file包,在下文中一共展示了Files类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fileSourceFlow

import org.springframework.integration.dsl.file.Files; //导入依赖的package包/类
@Bean
public IntegrationFlow fileSourceFlow() {
	FileInboundChannelAdapterSpec messageSourceSpec = Files.inboundAdapter(new File(this.properties.getDirectory()));

	if (StringUtils.hasText(this.properties.getFilenamePattern())) {
		messageSourceSpec.patternFilter(this.properties.getFilenamePattern());
	} else if (this.properties.getFilenameRegex() != null) {
		messageSourceSpec.regexFilter(this.properties.getFilenameRegex().pattern());
	}

	messageSourceSpec.preventDuplicates(this.properties.isPreventDuplicates());

	IntegrationFlowBuilder flowBuilder = IntegrationFlows.from(messageSourceSpec);

	return FileUtils.enhanceFlowForReadingMode(flowBuilder, this.fileConsumerProperties)
			.channel(source.output())
			.get();
}
 
开发者ID:spring-cloud-stream-app-starters,项目名称:file,代码行数:19,代码来源:FileSourceConfiguration.java

示例2: fileSourceFlow

import org.springframework.integration.dsl.file.Files; //导入依赖的package包/类
@Bean
public IntegrationFlow fileSourceFlow() {
	FileInboundChannelAdapterSpec messageSourceSpec = Files.inboundAdapter(new File(this.properties.getDirectory()));

	if (StringUtils.hasText(this.properties.getFilenamePattern())) {
		messageSourceSpec.patternFilter(this.properties.getFilenamePattern());
	} else if (this.properties.getFilenameRegex() != null) {
		messageSourceSpec.regexFilter(this.properties.getFilenameRegex().pattern());
	}

	if (this.properties.isPreventDuplicates()) {
		messageSourceSpec.preventDuplicates();
	}

	IntegrationFlowBuilder flowBuilder = IntegrationFlows
			.from(messageSourceSpec,
					new Consumer<SourcePollingChannelAdapterSpec>() {

						@Override
						public void accept(SourcePollingChannelAdapterSpec sourcePollingChannelAdapterSpec) {
							sourcePollingChannelAdapterSpec
									.poller(defaultPoller);
						}

					});
	return FileUtils.enhanceFlowForReadingMode(flowBuilder, this.fileConsumerProperties)
			.channel(source.output())
			.get();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-starters,代码行数:30,代码来源:FileSourceConfiguration.java

示例3: incomingFiles

import org.springframework.integration.dsl.file.Files; //导入依赖的package包/类
@Bean
IntegrationFlow incomingFiles(@Value("${HOME}/Desktop/in") File dir) {

    return IntegrationFlows.from(
            Files.inboundAdapter(dir)
                    .preventDuplicates()
                    .autoCreateDirectory(true),
            poller -> poller.poller(spec -> spec.fixedRate(1, TimeUnit.SECONDS)))
            .channel( this.files())
            .get();

}
 
开发者ID:livelessons-spring,项目名称:building-microservices,代码行数:13,代码来源:IntegrationConfiguration.java


注:本文中的org.springframework.integration.dsl.file.Files类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。