<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd http://www.springframework.org/schema/integration/ftp http://www.springframework.org/schema/integration/ftp/spring-integration-ftp.xsd" xmlns:context="http://www.springframework.org/schema/context" xmlns:int="http://www.springframework.org/schema/integration" xmlns:task="http://www.springframework.org/schema/task" xmlns:int-ftp="http://www.springframework.org/schema/integration/ftp"> <int:poller default="true" max-messages-per-poll="10" cron="*/10 * * * * *" /> <task:executor id="taskExecutor" pool-size="20" queue-capacity="20" /> <int:publish-subscribe-channel id="eventPublishChannel" /> <int:publish-subscribe-channel id="asyncEventPublishChannel" task-executor="taskExecutor" /> <int:channel id="ftpChannel"> <!-- <int:queue capacity="25" /> --> </int:channel> <bean id="ftpSessionFactory" class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory"> <property name="host" value="${sudoor.ftp.host}" /> <property name="port" value="${sudoor.ftp.port}" /> <property name="username" value="${sudoor.ftp.username}" /> <property name="password" value="${sudoor.ftp.password}" /> <property name="clientMode" value="${sudoor.ftp.clientMode}" /> <property name="fileType" value="${sudoor.ftp.fileType}" /> <property name="bufferSize" value="${sudoor.ftp.bufferSize}" /> </bean> <int-ftp:outbound-channel-adapter id="ftpOutbound" channel="ftpChannel" session-factory="ftpSessionFactory" charset="UTF-8" remote-file-separator="/" auto-create-directory="true" remote-directory="${sudoor.ftp.directory}" mode="REPLACE" /> </beans>
import org.springframework.integration.annotation.Gateway; import org.springframework.integration.annotation.MessagingGateway; @MessagingGateway public interface AsyncEventMessageGateway { @Gateway(requestChannel = "asyncEventPublishChannel") public void publishEvent(Object event); }
import java.util.Date; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.integration.annotation.MessageEndpoint; import org.springframework.integration.annotation.ServiceActivator; @MessageEndpoint public class DefaultEventServiceActivator { final Logger logger = LoggerFactory.getLogger(DefaultEventServiceActivator.class); @ServiceActivator(inputChannel = "eventPublishChannel") public void handle(Object event) throws Exception { logger.debug("Get Event: {} @ {}", event, new Date()); } @ServiceActivator(inputChannel = "asyncEventPublishChannel") public void handleAsyncEvent(Object event) throws Exception { logger.debug("Get Asnyc Event: {} @ {}", event, new Date()); } }
import org.springframework.integration.annotation.Gateway; import org.springframework.integration.annotation.MessagingGateway; @MessagingGateway public interface EventMessageGateway { @Gateway(requestChannel = "eventPublishChannel") public void publishEvent(Object event); }
import org.springframework.integration.annotation.Gateway; import org.springframework.integration.annotation.MessagingGateway; @MessagingGateway public interface FtpMessageGateway { @Gateway(requestChannel = "ftpChannel") public void sendFtpMessage(Object event); }
@MessageEndpoint public class RegisterManagerActivator { private static Logger logger = LoggerFactory.getLogger(RegisterManagerActivator.class); //private EventMessageGateway eventMessageGateway; @Autowired private AsyncEventMessageGateway asyncEventMessageGateway;//异步 @ServiceActivator(inputChannel = "asyncEventPublishChannel") public void handle(Object event) throws Exception { } }
@Component public class SignUtils{ @Autowired private AsyncEventMessageGateway asyncEventMessageGateway;//异步 public void addResponseChinapnrLogEventPublish(String responseType,String responseCode,String responseKey ,String responseDescription){ ResponseLog responseLog = new ResponseLog(); responseLog.setResponseType(responseType); responseLog.setResponseCode(responseCode); responseLog.setResponseKey(responseKey); responseLog.setResponseDescription(responseDescription); responseLog.setResponseDate(new Date()); asyncEventMessageGateway.publishEvent(responseLog); } }
相关推荐
Spring Integration + Spring WS 整合 在 Java 领域中,Spring Integration 和 Spring WS 是两个常用的框架,它们分别负责集成系统和 Web 服务。今天,我们将探讨如何将这两个框架整合在一起,实现一个完整的 Web ...
### Spring Integration in Action #### Part 1 - 背景 **1: Spring Integration 的介绍** - **Spring Integration 概览:** Spring Integration 是一个基于 Spring 框架的企业集成解决方案,它提供了一种声明式...
《Spring Source Spring Integration in Action》是一本专注于Spring Integration框架的实战指南,旨在帮助读者深入理解和应用这个强大的系统集成工具。Spring Integration是Spring框架家族的一部分,它提供了一种...
本文是一篇关于Spring Integration框架的介绍与分析,该框架是SpringSource公司的产品,旨在帮助企业应用间的集成。文章深入探讨了企业应用集成(EAI)的定义、消息传递的概念以及Spring Integration框架的基本概念...
Spring Integration。 官网 Spring Integration API。 Spring Integration 开发文档。
《Pro Spring Integration》是Spring框架领域的一本权威著作,由Manning出版社出版,提供英文原版,非扫描且质量高清,确保读者可以清晰地阅读和理解其中的代码示例和图表。这本书深入探讨了Spring Integration这一...
### Spring Integration介绍 #### 一、Spring Integration概览 **Spring Integration** 是Spring框架的一个扩展项目,它提供了构建企业集成应用程序所需的各种功能和支持。通过利用现有的Spring编程模型和依赖注入...
《Spring Integration 源码深度解析》 Spring Integration 是 Spring 框架的重要组成部分,它为 Java 应用提供了一种轻量级、声明式的集成解决方案,使得在不同系统、服务间的数据交换变得简单易行。Spring ...
《Pro Spring Integration》是一本专注于Spring Integration框架的书籍,由多位作者撰写,旨在帮助读者构建企业级集成解决方案。Spring Integration是为了解决企业中不同应用程序之间数据和服务集成而产生的解决方案...
Spring Integration 是一个基于 Spring 框架的轻量级企业级集成库,它提供了一种声明式的方法来处理系统间的消息传递和数据流。这个"spring integration master"压缩包文件很可能是包含了一系列示例,帮助开发者更好...
Spring Integration Essentials 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书
Spring Integration Essentials 英文无水印转化版pdf pdf所有页面使用FoxitReader、PDF-XChangeViewer、SumatraPDF和Firefox测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细...
### Spring Integration概述与核心概念 #### 一、Spring Integration简介 Spring Integration是由Spring框架团队开发的一个强大而灵活的企业级应用集成框架。它基于Spring的核心功能,提供了丰富的抽象层来简化...
**Spring Integration 概述** Spring Integration 是 Spring 框架的一个扩展,旨在简化企业级应用中的集成问题。它提供了一种声明式的方式,用于处理系统间的异步通信、消息传递和数据转换。Spring Integration ...
### Spring Integration 引用手册4 #### Spring Integration 概述 Spring Integration 是一个用于实现企业集成模式的框架,它基于 Spring 的编程和配置模型,提供了支持不同消息传递技术的适配器和消息路由功能。...