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


Java IntegrationFlows.from方法代码示例

本文整理汇总了Java中org.springframework.integration.dsl.IntegrationFlows.from方法的典型用法代码示例。如果您正苦于以下问题:Java IntegrationFlows.from方法的具体用法?Java IntegrationFlows.from怎么用?Java IntegrationFlows.from使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.integration.dsl.IntegrationFlows的用法示例。


在下文中一共展示了IntegrationFlows.from方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fileSourceFlow

import org.springframework.integration.dsl.IntegrationFlows; //导入方法依赖的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: pollingFlow

import org.springframework.integration.dsl.IntegrationFlows; //导入方法依赖的package包/类
@Bean
public IntegrationFlow pollingFlow() {
	IntegrationFlowBuilder flowBuilder = IntegrationFlows.from(jdbcMessageSource(),
			new Consumer<SourcePollingChannelAdapterSpec>() {

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

			});
	if (this.properties.isSplit()) {
		flowBuilder.split();
	}
	flowBuilder.channel(this.source.output());
	return flowBuilder.get();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-starters,代码行数:18,代码来源:JdbcSourceConfiguration.java

示例3: getFlowBuilder

import org.springframework.integration.dsl.IntegrationFlows; //导入方法依赖的package包/类
/**
 * Method to build Integration Flow for Mail. Suppress Warnings for
 * MailInboundChannelAdapterSpec.
 * @return Integration Flow object for Mail Source
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
private IntegrationFlowBuilder getFlowBuilder() {

	IntegrationFlowBuilder flowBuilder;
	URLName urlName = this.properties.getUrl();

	if (this.properties.isIdleImap()) {
		flowBuilder = getIdleImapFlow(urlName);
	}
	else {
		MailInboundChannelAdapterSpec adapterSpec;
		switch (urlName.getProtocol().toUpperCase()) {
			case "IMAP":
			case "IMAPS":
				adapterSpec = getImapFlowBuilder(urlName);
				break;
			case "POP3":
			case "POP3S":
				adapterSpec = getPop3FlowBuilder(urlName);
				break;
			default:
				throw new IllegalArgumentException(
						"Unsupported mail protocol: " + urlName.getProtocol());
		}
		flowBuilder = IntegrationFlows.from(
				adapterSpec.javaMailProperties(getJavaMailProperties(urlName))
						.userFlag(this.properties.getUserFlag())
						.selectorExpression(this.properties.getExpression())
						.shouldDeleteMessages(this.properties.isDelete()));

	}
	return flowBuilder;
}
 
开发者ID:spring-cloud-stream-app-starters,项目名称:mail,代码行数:39,代码来源:MailSourceConfiguration.java

示例4: getIdleImapFlow

import org.springframework.integration.dsl.IntegrationFlows; //导入方法依赖的package包/类
/**
 * Method to build Integration flow for IMAP Idle configuration.
 * @param urlName Mail source URL.
 * @return Integration Flow object IMAP IDLE.
 */
private IntegrationFlowBuilder getIdleImapFlow(URLName urlName) {
	return IntegrationFlows.from(Mail.imapIdleAdapter(urlName.toString())
			.shouldDeleteMessages(this.properties.isDelete())
			.userFlag(this.properties.getUserFlag())
			.javaMailProperties(getJavaMailProperties(urlName))
			.selectorExpression(this.properties.getExpression())
			.shouldMarkMessagesAsRead(this.properties.isMarkAsRead()));
}
 
开发者ID:spring-cloud-stream-app-starters,项目名称:mail,代码行数:14,代码来源:MailSourceConfiguration.java

示例5: pollingFlow

import org.springframework.integration.dsl.IntegrationFlows; //导入方法依赖的package包/类
@Bean
public IntegrationFlow pollingFlow() {
	IntegrationFlowBuilder flowBuilder = IntegrationFlows.from(jdbcMessageSource());
	if (this.properties.isSplit()) {
		flowBuilder.split();
	}
	flowBuilder.channel(this.source.output());
	return flowBuilder.get();
}
 
开发者ID:spring-cloud-stream-app-starters,项目名称:jdbc,代码行数:10,代码来源:JdbcSourceConfiguration.java

示例6: ftpInboundFlow

import org.springframework.integration.dsl.IntegrationFlows; //导入方法依赖的package包/类
@Bean
public IntegrationFlow ftpInboundFlow(SessionFactory<FTPFile> ftpSessionFactory, FtpSourceProperties properties,
		FileConsumerProperties fileConsumerProperties) {
	FtpInboundChannelAdapterSpec messageSourceBuilder = Ftp.inboundAdapter(ftpSessionFactory)
			.preserveTimestamp(properties.isPreserveTimestamp())
			.remoteDirectory(properties.getRemoteDir())
			.remoteFileSeparator(properties.getRemoteFileSeparator())
			.localDirectory(properties.getLocalDir())
			.autoCreateLocalDirectory(properties.isAutoCreateLocalDir())
			.temporaryFileSuffix(properties.getTmpFileSuffix())
			.deleteRemoteFiles(properties.isDeleteRemoteFiles());

	if (StringUtils.hasText(properties.getFilenamePattern())) {
		messageSourceBuilder.filter(new FtpSimplePatternFileListFilter(properties.getFilenamePattern()));
	}
	else if (properties.getFilenameRegex() != null) {
		messageSourceBuilder
				.filter(new FtpRegexPatternFileListFilter(properties.getFilenameRegex()));
	}

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

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

	});

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

示例7: sftpInboundFlow

import org.springframework.integration.dsl.IntegrationFlows; //导入方法依赖的package包/类
@Bean
public IntegrationFlow sftpInboundFlow(SessionFactory<LsEntry> sftpSessionFactory, SftpSourceProperties properties,
		FileConsumerProperties fileConsumerProperties) {
	SftpInboundChannelAdapterSpec messageSourceBuilder = Sftp.inboundAdapter(sftpSessionFactory)
			.preserveTimestamp(properties.isPreserveTimestamp())
			.remoteDirectory(properties.getRemoteDir())
			.remoteFileSeparator(properties.getRemoteFileSeparator())
			.localDirectory(properties.getLocalDir())
			.autoCreateLocalDirectory(properties.isAutoCreateLocalDir())
			.temporaryFileSuffix(properties.getTmpFileSuffix())
			.deleteRemoteFiles(properties.isDeleteRemoteFiles());

	if (StringUtils.hasText(properties.getFilenamePattern())) {
		messageSourceBuilder.filter(new SftpSimplePatternFileListFilter(properties.getFilenamePattern()));
	}
	else if (properties.getFilenameRegex() != null) {
		messageSourceBuilder
				.filter(new SftpRegexPatternFileListFilter(properties.getFilenameRegex()));
	}

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

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

	});

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

示例8: getIdleImapFlow

import org.springframework.integration.dsl.IntegrationFlows; //导入方法依赖的package包/类
/**
 * Method to build Integration flow for IMAP Idle configuration.
 * @param urlName Mail source URL.
 * @return Integration Flow object IMAP IDLE.
 */
private IntegrationFlowBuilder getIdleImapFlow(URLName urlName) {
	return IntegrationFlows.from(Mail.imapIdleAdapter(urlName.toString())
			.shouldDeleteMessages(this.properties.isDelete())
			.javaMailProperties(getJavaMailProperties(urlName))
			.selectorExpression(this.properties.getExpression())
			.shouldMarkMessagesAsRead(this.properties.isMarkAsRead()));
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-starters,代码行数:13,代码来源:MailSourceConfiguration.java

示例9: fileSourceFlow

import org.springframework.integration.dsl.IntegrationFlows; //导入方法依赖的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

示例10: startFlow

import org.springframework.integration.dsl.IntegrationFlows; //导入方法依赖的package包/类
@Bean
public IntegrationFlow startFlow() throws Exception {
    IntegrationFlowBuilder flow =  IntegrationFlows.from(mongoSource());
    if (config.isSplit()) {
        flow.split();
    }
    flow.channel(output);
    return flow.get();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-starters,代码行数:10,代码来源:MongodbSourceConfiguration.java

示例11: processNewPriorityOrders

import org.springframework.integration.dsl.IntegrationFlows; //导入方法依赖的package包/类
@Bean
public IntegrationFlow processNewPriorityOrders() {
    IntegrationFlowBuilder builder = IntegrationFlows.from(IntegrationFlowKeys.PRIORITY_ORDER_PROCESSING_QUEUE);
    return newOrderEventProcessingFlow(builder, true)
            .get();
}
 
开发者ID:MarcinStachowiak,项目名称:spring-integration-dsl-samle,代码行数:7,代码来源:NewOrderIncommingFlowConfiguration.java

示例12: processNewNotPriorityOrders

import org.springframework.integration.dsl.IntegrationFlows; //导入方法依赖的package包/类
@Bean
public IntegrationFlow processNewNotPriorityOrders() {
    IntegrationFlowBuilder builder = IntegrationFlows.from(IntegrationFlowKeys.NOT_PRIORITY_ORDER_PROCESSING_QUEUE);
    return newOrderEventProcessingFlow(builder, false)
            .get();
}
 
开发者ID:MarcinStachowiak,项目名称:spring-integration-dsl-samle,代码行数:7,代码来源:NewOrderIncommingFlowConfiguration.java

示例13: getFlowBuilder

import org.springframework.integration.dsl.IntegrationFlows; //导入方法依赖的package包/类
/**
 * Method to build Integration Flow for Mail. Suppress Warnings for
 * MailInboundChannelAdapterSpec.
 * @return Integration Flow object for Mail Source
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
private IntegrationFlowBuilder getFlowBuilder() {

	IntegrationFlowBuilder flowBuilder;
	URLName urlName = this.properties.getUrl();

	if (this.properties.isIdleImap()) {
		flowBuilder = getIdleImapFlow(urlName);
	}
	else {

		MailInboundChannelAdapterSpec adapterSpec;
		switch (urlName.getProtocol().toUpperCase()) {
			case "IMAP":
			case "IMAPS":
				adapterSpec = getImapFlowBuilder(urlName);
				break;
			case "POP3":
			case "POP3S":
				adapterSpec = getPop3FlowBuilder(urlName);
				break;
			default:
				throw new IllegalArgumentException(
						"Unsupported mail protocol: " + urlName.getProtocol());
		}
		flowBuilder = IntegrationFlows.from(
				adapterSpec.javaMailProperties(getJavaMailProperties(urlName))
						.selectorExpression(this.properties.getExpression())
						.shouldDeleteMessages(this.properties.isDelete()),
				new Consumer<SourcePollingChannelAdapterSpec>() {

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

				});

	}
	return flowBuilder;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-starters,代码行数:48,代码来源:MailSourceConfiguration.java


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