- 浏览: 263541 次
- 性别:
- 来自: 成都
-
文章分类
最新评论
-
zhagener:
package com.huawei.qyq.impl;imp ...
EasyMock使用说明 -
LetCode:
将String转换成InputStream -
Mr_kimilo:
MyEclipse6.5安装的时候出现问题: JS Test ...
javascript测试工具: JsTestDriver -
jersey109:
我同意楼下的,SQLException和IOException ...
check exception和uncheck exception -
jersey109:
楼主,你不说CODE,我觉得你对RuntimeExceptio ...
check exception和uncheck exception
Spring Integration是Spring公司的一套ESB框架。
前面ESB介绍中我也做了一定了解。我们来看一下它主要做什么的。
Spring Integration is motivated by the following goals:
- Provide a simple model for implementing complex enterprise integration solutions.(暂时相信它吧,谁让它搞个Spring框架,的确给人方便一把。)
- Facilitate asynchronous, message-driven behavior within a Spring-based application.(这个不谈,Spring框架就是它玩的。再说这一点与它竞争只有Mule啦。)
- Promote intuitive, incremental adoption for existing Spring users. (也暂时相信它,别人都只说给用户提升。)
Spring Integration is guided by the following principles:
- Components should be loosely coupled for modularity and testability.(松耦合,好像很早很早就听说过。像做梦一样)
- The framework should enforce separation of concerns between business logic and integration logic.(分开程度要取决业务吧。)
- Extension points should be abstract in nature but within well-defined boundaries to promote reuse and portability.(美妙现实世界产品)
主页上也没有东东,但有个下源代码的地方,svn开工啦。
svn co https://src.springframework.org/svn/spring-integration/trunk springintegration
下载完后,进入build-spring-integration目录执行ant.完成后,导入到Eclipse中。
导入项目会有很多,先添加时会有报错。这里需要添加一个变量。
IVY_CACHE=<checkout-dir>/ivy-cache/repository
这里要注意的事,也是我遇到问题。执行ant时,他会去下载lvy,如果你本身在%ANT_HOME%\lib里有lvy.jar包,由于我暂时找不到如何处理,我就直接将Ant中的jar删除掉后就没有问题。
另外在ant过程中,测试步骤可能会在file模块中出现问题,可以将相关test类中代码注释掉。
- package org.springframework.integration.samples.helloworld;
- /**
- * @author Mark Fisher
- */
- public class HelloService {
- public String sayHello(String name) {
- return "Hello " + name;
- }
- }
- package org.springframework.integration.samples.helloworld;
- /**
- * @author Mark Fisher
- */
- public class HelloService {
- public String sayHello(String name) {
- return "Hello " + name;
- }
- }
package org.springframework.integration.samples.helloworld; /** * @author Mark Fisher */ public class HelloService { public String sayHello(String name) { return "Hello " + name; } }
helloworldDemo.xml
- <?xml version="1.0" encoding="UTF-8"?>
- <beans:beans xmlns="http://www.springframework.org/schema/integration"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:beans="http://www.springframework.org/schema/beans"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/integration
- http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
- <channel id="inputChannel"/>
- <channel id="outputChannel">
- <queue capacity="10"/>
- </channel>
- <service-activator input-channel="inputChannel"
- output-channel="outputChannel"
- ref="helloService"
- method="sayHello"/>
- <beans:bean id="helloService" class="org.springframework.integration.samples.helloworld.HelloService"/>
- </beans:beans>
- <?xml version="1.0" encoding="UTF-8"?>
- <beans:beans xmlns="http://www.springframework.org/schema/integration"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:beans="http://www.springframework.org/schema/beans"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/integration
- http://www.springframework.org/schema/integration/spring-integration-1.0.xsd">
- <channel id="inputChannel"/>
- <channel id="outputChannel">
- <queue capacity="10"/>
- </channel>
- <service-activator input-channel="inputChannel"
- output-channel="outputChannel"
- ref="helloService"
- method="sayHello"/>
- <beans:bean id="helloService" class="org.springframework.integration.samples.helloworld.HelloService"/>
- </beans:beans>
<?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns="http://www.springframework.org/schema/integration" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-1.0.xsd"> <channel id="inputChannel"/> <channel id="outputChannel"> <queue capacity="10"/> </channel> <service-activator input-channel="inputChannel" output-channel="outputChannel" ref="helloService" method="sayHello"/> <beans:bean id="helloService" class="org.springframework.integration.samples.helloworld.HelloService"/> </beans:beans>
HelloWorldDemo.java
- package org.springframework.integration.samples.helloworld;
- import org.springframework.context.support.AbstractApplicationContext;
- import org.springframework.context.support.ClassPathXmlApplicationContext;
- import org.springframework.integration.channel.BeanFactoryChannelResolver;
- import org.springframework.integration.channel.ChannelResolver;
- import org.springframework.integration.channel.PollableChannel;
- import org.springframework.integration.core.MessageChannel;
- import org.springframework.integration.message.StringMessage;
- /**
- * Demonstrates a basic message endpoint.
- *
- * @author Mark Fisher
- */
- public class HelloWorldDemo {
- public static void main(String[] args) {
- AbstractApplicationContext context = new ClassPathXmlApplicationContext("helloWorldDemo.xml", HelloWorldDemo.class);
- ChannelResolver channelResolver = new BeanFactoryChannelResolver(context);
- MessageChannel inputChannel = channelResolver.resolveChannelName("inputChannel");
- PollableChannel outputChannel = (PollableChannel) channelResolver.resolveChannelName("outputChannel");
- inputChannel.send(new StringMessage("World"));
- System.out.println(outputChannel.receive(0).getPayload());
- context.stop();
- }
- }
- package org.springframework.integration.samples.helloworld;
- import org.springframework.context.support.AbstractApplicationContext;
- import org.springframework.context.support.ClassPathXmlApplicationContext;
- import org.springframework.integration.channel.BeanFactoryChannelResolver;
- import org.springframework.integration.channel.ChannelResolver;
- import org.springframework.integration.channel.PollableChannel;
- import org.springframework.integration.core.MessageChannel;
- import org.springframework.integration.message.StringMessage;
- /**
- * Demonstrates a basic message endpoint.
- *
- * @author Mark Fisher
- */
- public class HelloWorldDemo {
- public static void main(String[] args) {
- AbstractApplicationContext context = new ClassPathXmlApplicationContext("helloWorldDemo.xml", HelloWorldDemo.class);
- ChannelResolver channelResolver = new BeanFactoryChannelResolver(context);
- MessageChannel inputChannel = channelResolver.resolveChannelName("inputChannel");
- PollableChannel outputChannel = (PollableChannel) channelResolver.resolveChannelName("outputChannel");
- inputChannel.send(new StringMessage("World"));
- System.out.println(outputChannel.receive(0).getPayload());
- context.stop();
- }
- }
package org.springframework.integration.samples.helloworld; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.integration.channel.BeanFactoryChannelResolver; import org.springframework.integration.channel.ChannelResolver; import org.springframework.integration.channel.PollableChannel; import org.springframework.integration.core.MessageChannel; import org.springframework.integration.message.StringMessage; /** * Demonstrates a basic message endpoint. * * @author Mark Fisher */ public class HelloWorldDemo { public static void main(String[] args) { AbstractApplicationContext context = new ClassPathXmlApplicationContext("helloWorldDemo.xml", HelloWorldDemo.class); ChannelResolver channelResolver = new BeanFactoryChannelResolver(context); MessageChannel inputChannel = channelResolver.resolveChannelName("inputChannel"); PollableChannel outputChannel = (PollableChannel) channelResolver.resolveChannelName("outputChannel"); inputChannel.send(new StringMessage("World")); System.out.println(outputChannel.receive(0).getPayload()); context.stop(); } }
其示例描述在:http://www.enterpriseintegrationpatterns.com/ramblings/18_starbucks.html
这里简单描述一下,以免大家看英文太累
文章讲在星巴克喝咖啡时,收银员可能只有一个,而冲咖啡员工会有多个,如何让收银员产生订单异步发送给冲咖啡员工。并且冲咖啡员工可能是竞争上岗的,就当他们是计件工吧。
这里要考虑问题:
1,冲咖啡员工使用不同设备,不同咖啡冲调时间可能不同。
2,冲咖啡员工可能会将相同类型的咖啡同时一起冲调。
星巴克如何处理这个问题?
就当他解决了这个问题,它是如何把每个咖啡又送回给每个客户呢?当然,星巴克采用“标识关系模式”,将每个咖啡杯上标上名称,并通过叫喊方式。
但并不是每天都是美好的,总有出错的时候。例如,收银员无法支付?冲调一杯你不喜欢的咖啡,你要换一杯?冲咖啡的设备坏了,星巴克要退你钱...这些异常情况如何处理。
因此就会有以下三种方式异常处理:
1,关闭交易,什么都不做。
2,重做,重新发起行为。
3,修正行为,相当于退钱这种行为。
因此,这里这篇文章后面讨论一下两阶段提交为什么不适合星巴克,如果你让收银员、冲咖啡员工,买单的人需要在一个“事务”中,交易所有完成后,再进行下一个业务。估计星巴克会马上倒闭啦。因此星巴克采用“Conversation pattern”模式。
好啦,业务了解清楚,我们再来看一下完整XML文件。在这里我没有采用示例详细的xml方式,而没有采用annotation方式。
- <?xml version="1.0" encoding="UTF-8"?>
- <beans:beans xmlns="http://www.springframework.org/schema/integration"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:beans="http://www.springframework.org/schema/beans"
- xmlns:stream="http://www.springframework.org/schema/integration/stream"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/integration
- http://www.springframework.org/schema/integration/spring-integration-1.0.xsd
- http://www.springframework.org/schema/integration/stream
- http://www.springframework.org/schema/integration/stream/spring-integration-stream-1.0.xsd">
- <gateway id="cafe" service-interface="org.springframework.integration.samples.cafe.Cafe"/>
- <channel id="orders"/>
- <splitter input-channel="orders" ref="orderSplitter" method="split" output-channel="drinks"/>
- <channel id="drinks"/>
- <router input-channel="drinks" ref="drinkRouter" method="resolveOrderItemChannel"/>
- <channel id="coldDrinks">
- <queue capacity="10"/>
- </channel>
- <service-activator input-channel="coldDrinks" ref="barista"
- method="prepareColdDrink" output-channel="preparedDrinks"/>
- <channel id="hotDrinks">
- <queue capacity="10"/>
- </channel>
- <service-activator input-channel="hotDrinks" ref="barista"
- method="prepareHotDrink" output-channel="preparedDrinks"/>
- <channel id="preparedDrinks"/>
- <aggregator input-channel="preparedDrinks" ref="waiter"
- method="prepareDelivery" output-channel="deliveries"/>
- <stream:stdout-channel-adapter id="deliveries"/>
- <beans:bean id="orderSplitter"
- class="org.springframework.integration.samples.cafe.xml.OrderSplitter"/>
- <beans:bean id="drinkRouter"
- class="org.springframework.integration.samples.cafe.xml.DrinkRouter"/>
- <beans:bean id="barista" class="org.springframework.integration.samples.cafe.xml.Barista"/>
- <beans:bean id="waiter" class="org.springframework.integration.samples.cafe.xml.Waiter"/>
- <poller id="poller" default="true">
- <interval-trigger interval="1000"/>
- </poller>
- </beans:beans>
- <?xml version="1.0" encoding="UTF-8"?>
- <beans:beans xmlns="http://www.springframework.org/schema/integration"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:beans="http://www.springframework.org/schema/beans"
- xmlns:stream="http://www.springframework.org/schema/integration/stream"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/integration
- http://www.springframework.org/schema/integration/spring-integration-1.0.xsd
- http://www.springframework.org/schema/integration/stream
- http://www.springframework.org/schema/integration/stream/spring-integration-stream-1.0.xsd">
- <gateway id="cafe" service-interface="org.springframework.integration.samples.cafe.Cafe"/>
- <channel id="orders"/>
- <splitter input-channel="orders" ref="orderSplitter" method="split" output-channel="drinks"/>
- <channel id="drinks"/>
- <router input-channel="drinks" ref="drinkRouter" method="resolveOrderItemChannel"/>
- <channel id="coldDrinks">
- <queue capacity="10"/>
- </channel>
- <service-activator input-channel="coldDrinks" ref="barista"
- method="prepareColdDrink" output-channel="preparedDrinks"/>
- <channel id="hotDrinks">
- <queue capacity="10"/>
- </channel>
- <service-activator input-channel="hotDrinks" ref="barista"
- method="prepareHotDrink" output-channel="preparedDrinks"/>
- <channel id="preparedDrinks"/>
- <aggregator input-channel="preparedDrinks" ref="waiter"
- method="prepareDelivery" output-channel="deliveries"/>
- <stream:stdout-channel-adapter id="deliveries"/>
- <beans:bean id="orderSplitter"
- class="org.springframework.integration.samples.cafe.xml.OrderSplitter"/>
- <beans:bean id="drinkRouter"
- class="org.springframework.integration.samples.cafe.xml.DrinkRouter"/>
-
<beans:bean id="barista" class="org.springframework.integration.samples.cafe.xml.Barista"</span
发表评论
-
OpenID资源大全
2009-11-04 16:45 1307OpenID 是一个在网络上对用户进行验证的分散式框架,Ope ... -
oAuth无痛入门指南
2009-11-04 16:23 4456决心写个入门指南,理 ... -
使用Mock对象进行单元测试
2009-10-19 16:47 10071.出了什么问题? 单元测试的目标是一次只验证一个方 ... -
Mockito入门
2009-10-19 16:24 1635简介 InfoQ-使用Mockito 1.5监视普通 ... -
暴强的Javarebel——让JavaEE开发像ROR一样方便
2009-10-15 15:39 1011ROR之所以开发效率比java ... -
修改Java文件后终于不用重启服务器了
2009-10-15 15:36 1315今天发现一个很NB的玩意,让我们在开发的时候修改Java文件 ... -
什么是EIP
2009-09-24 16:08 1267EIP企业信息平台(Enterpr ... -
camel 入门
2009-09-24 16:07 2658前段时间和一些朋友聊 ...
相关推荐
9. **Spring Integration**:提供了异步处理、消息驱动和企业服务总线(ESB)等集成解决方案。 10. **Spring Batch**:用于处理批量操作,如数据导入导出,适合大规模数据处理。 在学习笔记中,你可能会找到以下...
9. **Spring Integration**:提供异步处理、消息驱动和企业服务总线(ESB)功能,方便系统间的集成。 10. **Spring Batch**:专门用于批量处理任务的框架,支持复杂的批处理需求,如事务管理、错误处理和分页。 ...
5. **模块化开发**:Spring还支持模块化的开发,如Spring Security用于安全控制,Spring Batch用于批量处理,Spring Integration用于企业服务总线(ESB)功能。 【Spring Bean的生命周期】 在Spring框架中,Bean是...
8. **Spring Integration**:提供了多种企业服务总线(ESB)特性,用于在不同系统间进行消息传递和集成。 9. **Spring Cloud**:一套工具集,用于构建分布式系统中的服务发现、配置管理和微服务连接。 在 "SPRING-...
AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!
kolesar_3cd_01_0716
latchman_01_0108
matlab程序代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!
pimpinella_3cd_01_0716
petrilla_01_0308
AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!
内容概要:本文档由张卓老师讲解,重点探讨DeepSeek的技术革新及强化学习对未来AI发展的重要性。文章回顾了AI的历史与发展阶段,详细解析Transformer架构在AI上半场所起到的作用,深入介绍了MoE混合专家以及MLA低秩注意机制等技术特点如何帮助DeepSeek在AI中场建立优势,并探讨了当前强化学习的挑战和边界。文档不仅提及AlphaGo和小游戏等成功案例来说明强化学习的强大力量,还提出了关于未来人工通用智能(AGI)的展望,特别是如何利用强化学习提升现有LLMs的能力和性能。 适用人群:本资料适宜对深度学习感兴趣的研究人员、开发者以及想要深入了解人工智能最新进展的专业人士。 使用场景及目标:通过了解最新的AI技术和前沿概念,在实际工作中能够运用更先进的工具和技术解决问题。同时为那些寻求职业转型或者学术深造的人提供了宝贵的参考。 其他说明:文中提到了许多具体的例子和技术细节,如DeepSeek的技术特色、RL的理论背景等等,有助于加深读者对于现代AI系统的理解和认识。
有师傅小程序开源版v2.4.14 新增报价短信奉告 优化部分细节
AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!
商城二级三级分销系统(小程序+后台含源码).zip
li_3ck_01b_0918
nicholl_3cd_01_0516
媒体关注度是一个衡量公众对某个事件、话题或个体关注程度的重要指标。它主要反映了新闻媒体、社交媒体、博客等对于某一事件、话题或个体的报道和讨论程度。 媒体监督的J-F系数(Janis-Fadner系数)是一种用于测量媒体关注度的指标,特别是用于评估媒体对企业、事件或话题的监督力度。J-F系数基于媒体报道的正面和负面内容来计算,从而为公众、研究者或企业提供一个量化工具,以了解媒体对其关注的方向和强度。 本数据含原始数据、参考文献、代码do文件、最终结果。参考文献中JF系数计算公式。 指标 代码、年份、标题出现该公司的新闻总数、内容出现该公司的新闻总数、正面新闻数全部、中性新闻数全部、负面新闻数全部、正面新闻数原创、中性新闻数原创、负面新闻数原创,媒体监督JF系数。
AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!
AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!