??xml version="1.0" encoding="utf-8" standalone="yes"?>成年人免费在线视频,午夜精品久久久久久久99黑人,伊色综合久久之综合久久http://www.aygfsteel.com/paulwong/category/51928.htmlzh-cnFri, 21 Jan 2022 02:24:41 GMTFri, 21 Jan 2022 02:24:41 GMT60SPRING INTEGRATION - 集群选主、分布式?/title><link>http://www.aygfsteel.com/paulwong/archive/2022/01/20/439381.html</link><dc:creator>paulwong</dc:creator><author>paulwong</author><pubDate>Thu, 20 Jan 2022 05:49:00 GMT</pubDate><guid>http://www.aygfsteel.com/paulwong/archive/2022/01/20/439381.html</guid><wfw:comment>http://www.aygfsteel.com/paulwong/comments/439381.html</wfw:comment><comments>http://www.aygfsteel.com/paulwong/archive/2022/01/20/439381.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/paulwong/comments/commentRss/439381.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/paulwong/services/trackbacks/439381.html</trackback:ping><description><![CDATA[集群通常是有多个相同的实例,但对于定时Q务场景,只希望有一个实例工作即可,如果q个实例挂了Q其他实例可以顶ѝ?br /><br />q个问题的方案则是集选主Q一个集中Q只有一个LEADERQ由LEADER负责执行定时d工作。当LEADER被取消时Q会在剩下的实例中再选LEADER?br /><br />持有分布式锁的实例则是LEADER?br /><br />SPRING INTEGRATION JDBC 则已提供相关功能?br /><br />pom.xml<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->        <span style="color: #0000FF; "><</span><span style="color: #800000; ">dependency</span><span style="color: #0000FF; ">></span><br />           <span style="color: #0000FF; "><</span><span style="color: #800000; ">groupId</span><span style="color: #0000FF; ">></span>org.springframework.integration<span style="color: #0000FF; "></</span><span style="color: #800000; ">groupId</span><span style="color: #0000FF; ">></span><br />           <span style="color: #0000FF; "><</span><span style="color: #800000; ">artifactId</span><span style="color: #0000FF; ">></span>spring-integration-jdbc<span style="color: #0000FF; "></</span><span style="color: #800000; ">artifactId</span><span style="color: #0000FF; ">></span><br />        <span style="color: #0000FF; "></</span><span style="color: #800000; ">dependency</span><span style="color: #0000FF; ">></span><br /><br />        <span style="color: #0000FF; "><</span><span style="color: #800000; ">dependency</span><span style="color: #0000FF; ">></span><br />            <span style="color: #0000FF; "><</span><span style="color: #800000; ">groupId</span><span style="color: #0000FF; ">></span>org.springframework.boot<span style="color: #0000FF; "></</span><span style="color: #800000; ">groupId</span><span style="color: #0000FF; ">></span><br />            <span style="color: #0000FF; "><</span><span style="color: #800000; ">artifactId</span><span style="color: #0000FF; ">></span>spring-boot-starter-jdbc<span style="color: #0000FF; "></</span><span style="color: #800000; ">artifactId</span><span style="color: #0000FF; ">></span><br />        <span style="color: #0000FF; "></</span><span style="color: #800000; ">dependency</span><span style="color: #0000FF; ">></span><br /><br />        <span style="color: #0000FF; "><</span><span style="color: #800000; ">dependency</span><span style="color: #0000FF; ">></span><br />           <span style="color: #0000FF; "><</span><span style="color: #800000; ">groupId</span><span style="color: #0000FF; ">></span>org.flywaydb<span style="color: #0000FF; "></</span><span style="color: #800000; ">groupId</span><span style="color: #0000FF; ">></span><br />           <span style="color: #0000FF; "><</span><span style="color: #800000; ">artifactId</span><span style="color: #0000FF; ">></span>flyway-core<span style="color: #0000FF; "></</span><span style="color: #800000; ">artifactId</span><span style="color: #0000FF; ">></span><br />        <span style="color: #0000FF; "></</span><span style="color: #800000; ">dependency</span><span style="color: #0000FF; ">></span><br />        <br />        <span style="color: #0000FF; "><</span><span style="color: #800000; ">dependency</span><span style="color: #0000FF; ">></span><br />            <span style="color: #0000FF; "><</span><span style="color: #800000; ">groupId</span><span style="color: #0000FF; ">></span>org.mariadb.jdbc<span style="color: #0000FF; "></</span><span style="color: #800000; ">groupId</span><span style="color: #0000FF; ">></span><br />            <span style="color: #0000FF; "><</span><span style="color: #800000; ">artifactId</span><span style="color: #0000FF; ">></span>mariadb-java-client<span style="color: #0000FF; "></</span><span style="color: #800000; ">artifactId</span><span style="color: #0000FF; ">></span><br />        <span style="color: #0000FF; "></</span><span style="color: #800000; ">dependency</span><span style="color: #0000FF; ">></span></div><br />LeaderElectionIntegrationConfig.java<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">import</span> java.util.List;<br /><span style="color: #0000FF; ">import</span> java.util.concurrent.CopyOnWriteArrayList;<br /><br /><span style="color: #0000FF; ">import</span> javax.sql.DataSource;<br /><br /><span style="color: #0000FF; ">import</span> org.springframework.context.annotation.Bean;<br /><span style="color: #0000FF; ">import</span> org.springframework.context.annotation.Configuration;<br /><span style="color: #0000FF; ">import</span> org.springframework.integration.jdbc.lock.DefaultLockRepository;<br /><span style="color: #0000FF; ">import</span> org.springframework.integration.jdbc.lock.JdbcLockRegistry;<br /><span style="color: #0000FF; ">import</span> org.springframework.integration.jdbc.lock.LockRepository;<br /><span style="color: #0000FF; ">import</span> org.springframework.integration.support.leader.LockRegistryLeaderInitiator;<br /><br /><span style="color: #0000FF; ">import</span> com.paul.integration.leader.ControlBusGateway;<br /><span style="color: #0000FF; ">import</span> com.paul.integration.leader.MyCandidate;<br /><br />@Configuration<br /><span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">class</span> LeaderElectionIntegrationConfig {<br />    <br />    @Bean<br />    <span style="color: #0000FF; ">public</span> List<String> needToStartupAdapterList(){<br />        <span style="color: #0000FF; ">return</span> <span style="color: #0000FF; ">new</span> CopyOnWriteArrayList<>();<br />    }<br />    <br />    @Bean<br />    <span style="color: #0000FF; ">public</span> DefaultLockRepository defaultLockRepository(DataSource dataSource){<br />        DefaultLockRepository defaultLockRepository =<br />                <span style="color: #0000FF; ">new</span> DefaultLockRepository(dataSource);<br /><span style="color: #008000; ">//</span><span style="color: #008000; ">        defaultLockRepository.setTimeToLive(60_000);</span><span style="color: #008000; "><br /></span>        <span style="color: #0000FF; ">return</span> defaultLockRepository;<br />    }<br /><br />    @Bean<br />    <span style="color: #0000FF; ">public</span> JdbcLockRegistry jdbcLockRegistry(LockRepository lockRepository){<br />        <span style="color: #0000FF; ">return</span> <span style="color: #0000FF; ">new</span> JdbcLockRegistry(lockRepository);<br />    }<br />    <br />    @Bean<br />    <span style="color: #0000FF; ">public</span> MyCandidate myCandidate(<br />        ControlBusGateway controlBusGateway,<br />        List<String> needToStartupAdapterList<br />    ) {<br />        <span style="color: #0000FF; ">return</span> <span style="color: #0000FF; ">new</span> MyCandidate(controlBusGateway, needToStartupAdapterList);<br />    }<br />    <br />    @Bean<br />    <span style="color: #0000FF; ">public</span> LockRegistryLeaderInitiator leaderInitiator() {<br />        <span style="color: #0000FF; ">return</span> <span style="color: #0000FF; ">new</span> LockRegistryLeaderInitiator(<br />                    jdbcLockRegistry(<span style="color: #0000FF; ">null</span>), myCandidate(<span style="color: #0000FF; ">null</span>, <span style="color: #0000FF; ">null</span>)<br />               );<br />    }<br />    <br />    <br />}</div><br /><br /><div>MyCandidate.java</div><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">import</span> java.util.List;<br /><br /><span style="color: #0000FF; ">import</span> org.slf4j.Logger;<br /><span style="color: #0000FF; ">import</span> org.slf4j.LoggerFactory;<br /><span style="color: #0000FF; ">import</span> org.springframework.integration.leader.Context;<br /><span style="color: #0000FF; ">import</span> org.springframework.integration.leader.DefaultCandidate;<br /><br /><span style="color: #0000FF; ">import</span> com.novacredit.mcra.mcracommon.integration.gateway.ControlBusGateway;<br /><br /><span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">class</span> MyCandidate <span style="color: #0000FF; ">extends</span> DefaultCandidate{<br />    <br />    <span style="color: #0000FF; ">private</span> <span style="color: #0000FF; ">static</span> <span style="color: #0000FF; ">final</span> Logger LOG = LoggerFactory.getLogger(MyCandidate.<span style="color: #0000FF; ">class</span>);<br />    <br />    <span style="color: #0000FF; ">private</span> List<String> needToStartupAdapterList;<br />    <br />    <span style="color: #0000FF; ">private</span> ControlBusGateway controlBusGateway;<br />    <br />    <span style="color: #0000FF; ">public</span> MyCandidate(<br />        ControlBusGateway controlBusGateway,<br />        List<String> needToStartupAdapterList<br />    ) {<br />        <span style="color: #0000FF; ">this</span>.controlBusGateway = controlBusGateway;<br />        <span style="color: #0000FF; ">this</span>.needToStartupAdapterList = needToStartupAdapterList;<br />    }<br />    <br />    @Override<br />    <span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">void</span> onGranted(Context context) {<br />        <span style="color: #0000FF; ">super</span>.onGranted(context);<br />        LOG.info("*** Leadership granted ***");<br />        LOG.info("STARTING MONGODB POLLER");<br />        needToStartupAdapterList<br />            .forEach(<br />                c -> {<br /><span style="color: #008000; ">//</span><span style="color: #008000; ">                    c = "@'testIntegrationFlow.org.springframework.integration.config."<br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">                            + "SourcePollingChannelAdapterFactoryBean#0'";</span><span style="color: #008000; "><br /></span>                    String command = c + ".start()";<br />                    LOG.info("-----{}", command);<br />                    controlBusGateway.sendCommand(command);<br />                }<br />             );<br />        LOG.info("STARTUP MESSAGE SENT");<br /><br />    }<br /><br />    @Override<br />    <span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">void</span> onRevoked(Context context) {<br />        <span style="color: #0000FF; ">super</span>.onRevoked(context);<br />        LOG.info("*** Leadership revoked ***");<br />        LOG.info("STOPPING MONGODB POLLER");<br />        needToStartupAdapterList<br />            .forEach(<br />                c -> {<br /><span style="color: #008000; ">//</span><span style="color: #008000; ">                    c = "@'testIntegrationConfig.testIntegrationFlow."<br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">                            + "mongoMessageSource.inboundChannelAdapter'";</span><span style="color: #008000; "><br /></span>                    String command = c + ".stop()";<br />                    LOG.info("-----{}", command);<br /><span style="color: #008000; ">//</span><span style="color: #008000; ">                    controlBusGateway.sendCommand(command);</span><span style="color: #008000; "><br /></span>                }<br />             );<br />        LOG.info("SHUTDOWN MESSAGE SENT");<br />    }<br /><br />}</div><br /><br />ControlBusIntegrationConfig.java<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">import</span> org.springframework.context.annotation.Bean;<br /><span style="color: #0000FF; ">import</span> org.springframework.context.annotation.Configuration;<br /><span style="color: #0000FF; ">import</span> org.springframework.integration.dsl.IntegrationFlow;<br /><span style="color: #0000FF; ">import</span> org.springframework.integration.dsl.IntegrationFlows;<br /><span style="color: #0000FF; ">import</span> org.springframework.integration.dsl.MessageChannels;<br /><span style="color: #0000FF; ">import</span> org.springframework.integration.gateway.GatewayProxyFactoryBean;<br /><span style="color: #0000FF; ">import</span> org.springframework.integration.handler.LoggingHandler;<br /><span style="color: #0000FF; ">import</span> org.springframework.messaging.MessageChannel;<br /><br /><span style="color: #0000FF; ">import</span> com.paul.integration.gateway.ControlBusGateway;<br /><br />@Configuration<br /><span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">class</span> ControlBusIntegrationConfig {<br />    <br />    @Bean<br />    <span style="color: #0000FF; ">public</span> MessageChannel controlBusChannel() {<br />        <span style="color: #0000FF; ">return</span> MessageChannels.direct().get();<br />    }<br />    <br />    @Bean<br />    <span style="color: #0000FF; ">public</span> IntegrationFlow controlBusFlow() {<br />        <span style="color: #0000FF; ">return</span> IntegrationFlows.from(controlBusChannel())<br />                    .log(LoggingHandler.Level.INFO, "controlBusChannel")<br />                    .controlBus()<br />                    .get();<br />    }<br />    <br />    @Bean<br />    <span style="color: #0000FF; ">public</span> GatewayProxyFactoryBean controlBusGateway() {<br />        GatewayProxyFactoryBean gateway = <span style="color: #0000FF; ">new</span> GatewayProxyFactoryBean(ControlBusGateway.<span style="color: #0000FF; ">class</span>);<br />        gateway.setDefaultRequestChannel(controlBusChannel());<br />        gateway.setDefaultRequestTimeout(300l);<br />        gateway.setDefaultReplyTimeout(300l);<br />        <span style="color: #0000FF; ">return</span> gateway;<br />    }<br />    <br />}</div><br /><br />ControlBusGateway.java<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">interface</span> ControlBusGateway {<br />    <br />    <span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">void</span> sendCommand(String command);<br /><br />}</div><br /><br />各个应用实例q行Ӟ其中的LockRegistryLeaderInitiator会自动运行,抢夺LEADER数据Q最l只有一个实例夺取。之后再执行MyCandidate中的代码?br /><br /><br /><br /><br /><br /><br /><br /><img src ="http://www.aygfsteel.com/paulwong/aggbug/439381.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/paulwong/" target="_blank">paulwong</a> 2022-01-20 13:49 <a href="http://www.aygfsteel.com/paulwong/archive/2022/01/20/439381.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>EVEN DRIVEN - SPRING CLOUD STREAM 3.x - Functional Programming Modelhttp://www.aygfsteel.com/paulwong/archive/2021/11/10/436035.htmlpaulwongpaulwongWed, 10 Nov 2021 07:10:00 GMThttp://www.aygfsteel.com/paulwong/archive/2021/11/10/436035.htmlhttp://www.aygfsteel.com/paulwong/comments/436035.htmlhttp://www.aygfsteel.com/paulwong/archive/2021/11/10/436035.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/436035.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/436035.htmlSPRING CLOUD STREAM 3.x 版本Ӟ之前的一些编E模式,如@EnablebinddingQ@StreamListenner{注释被废弃了,q是׃一些框架的代码必需qL写,如配|框架用的Input MessageChannelQOutput  MessageChannelQ连接MessageHandler与MessageChannel{,被视Z必要的动作。ؓ了简化用户代码,于是推出Functional Programming Model?br />
引入了新名词QSupplier、Function与Consumer。实际上q几个类可视为AdapterQ如果之前已l有存在的Servicec,且方法名为各U各P可以重新包装成Supplier、Function与ConsumerQƈ在固定的Ҏ名:apply/get/accept中调用Service的方法?br />

Supplier

当在配置文g中注入此cd的BeanQƈ在spring.cloud.stream.function.definition加入此Bean的名UͼSPRING CLOUD STREAM׃帮你生成一个Output  MessageChannelQƈq接上此BeanQ后l只需要在BINDDING中加入对应的Destination NameQ即可向BROKER发消息了?br />

Consumer

当在配置文g中注入此cd的BeanQƈ在spring.cloud.stream.function.definition加入此Bean的名UͼSPRING CLOUD STREAM׃帮你生成一个Input  MessageChannelQƈq接上此BeanQ后l只需要在BINDDING中加入对应的Destination NameQ即可收到BROKER推送关于此Destination的消息了?br />

Function

当在配置文g中注入此cd的BeanQƈ在spring.cloud.stream.function.definition加入此Bean的名UͼSPRING CLOUD STREAM׃帮你生成一个Input和Output  MessageChannelQƈq接上此BeanQ后l只需要在BINDDING中分别对Input和Output MessageChannel加入对应的Destination Name1/Name2Q即可收到BROKER推送关于此Destination的消息,也可以向BROKER发消息了?br />

与SPRING INTEGRATION的整?/h2>如果要对消息q行复杂处理Q如拆分消息、聚合消息、IF ELSE消息{,p借助SPRING INTEGRATION了?br />
@Bean
    public IntegrationFlow upperCaseFlow(LoanService loanService) {
        return IntegrationFlows
                    //turn this IntegrationFlow as a gateway, here is a Function interface 
                    
//with loadCheckerFunction as bean name
                    .from(LoadCheckerFunction.class, gateway -> gateway.beanName("loadCheckerFunction"))
                    .handle(loanService, "check")
                    .logAndReply(LoggingHandler.Level.WARN);
    }

    public interface LoadCheckerFunction extends Function<Loan, Loan>{

    }

IntegrationFlows.from(Class<?> serviceInterface)是可以将本IntegrationFlow包装成serviceInterface的实现类Q如果调用此接口Q最l会q回IntegrationFlow最后一个步骤的实体Q如果这个serviceInterface是Function的话Q刚好和SPRING CLOUD STREAMҎ上?br />
后箋在spring.cloud.stream.function.definition加入此Bean的名UloadCheckerFunctionQSPRING CLOUD STREAM׃帮你生成一个Input和Output  MessageChannelQƈq接上此BeanQ再在BINDDING中分别对Input和Output MessageChannel加入对应的Destination Name1/Name2Q即可收到BROKER推送关于此Destination的消息,也可以向BROKER发消息?br />
application.yaml
# This setting can increase or decrease the rate of message production (1000 = 1s)
# spring.cloud.stream.poller.fixed-delay=1000

# This setting can control which function method in our code will be triggered if there are multiple
# spring.cloud.function.definition=supplyLoan

# Give the autogenerated binding a friendlier name

spring:
   application:
      name: loan-check-rabbit
   banner:
      location: classpath:/banner-rabbit.txt
   cloud:
      stream:
         function.definition: loadCheckerFunction
         #BindingProperties
         bindings:
            loadCheckerFunction-in-0:
               destination: queue.pretty.log.messages
               binder: local_rabbit
            loadCheckerFunction-out-0:
               destination: queue.pretty.approved.messages
               binder: local_rabbit
         #BinderProperties
         binders:
            local_rabbit:
               type: rabbit
               environment:
                  spring:
                     rabbitmq:
                        host: 10.80.27.69
                        port: 5672
                        username: guest
                        password: guest
                        virtual-host: my-virtual-host

Reference

https://spring.io/blog/2019/10/25/spring-cloud-stream-and-spring-integration

paulwong 2021-11-10 15:10 发表评论
]]>
SPRING INTEGRATION - ENRICHhttp://www.aygfsteel.com/paulwong/archive/2021/09/21/435976.htmlpaulwongpaulwongTue, 21 Sep 2021 05:40:00 GMThttp://www.aygfsteel.com/paulwong/archive/2021/09/21/435976.htmlhttp://www.aygfsteel.com/paulwong/comments/435976.htmlhttp://www.aygfsteel.com/paulwong/archive/2021/09/21/435976.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/435976.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/435976.html
package org.springframework.integration.stackoverflow.enricher;

import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpMethod;
import org.springframework.integration.dsl.IntegrationFlow;
import org.springframework.integration.dsl.IntegrationFlows;
import org.springframework.integration.dsl.Transformers;
import org.springframework.integration.http.dsl.Http;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
public class SpringIntegrationEnricherApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringIntegrationEnricherApplication.class, args);
    }

    @Bean
    public IntegrationFlow jsonEnricherFlow(RestTemplate restTemplate) {
        return IntegrationFlows.from(Function.class)
                .transform(Transformers.fromJson(Map.class))
                .enrich((enricher) -> enricher
                        .<Map<String, ?>>requestPayload((message) ->
                                ((List<?>) message.getPayload().get("attributeIds"))
                                        .stream()
                                        .map(Object::toString)
                                        .collect(Collectors.joining(",")))
                        .requestSubFlow((subFlow) ->
                                subFlow.handle(
                                        Http.outboundGateway("/attributes?id={ids}", restTemplate)
                                                .httpMethod(HttpMethod.GET)
                                                .expectedResponseType(Map.class)
                                                .uriVariable("ids", "payload")))
                        .propertyExpression("attributes", "payload.attributes"))
                .<Map<String, ?>, Map<String, ?>>transform(
                        (payload) -> {
                            payload.remove("attributeIds");
                            return payload;
                        })
                .transform(Transformers.toJson())
                .get();
    }

}

https://stackoverflow.com/questions/58205432/spring-integration-enrich-transform-message-using-rest-call

https://www.tabnine.com/web/assistant/code/rs/5c781b6ae70f87000197ab9f#L312



paulwong 2021-09-21 13:40 发表评论
]]>
SPRING INTEGRATION RETRYhttp://www.aygfsteel.com/paulwong/archive/2021/08/23/435950.htmlpaulwongpaulwongMon, 23 Aug 2021 05:01:00 GMThttp://www.aygfsteel.com/paulwong/archive/2021/08/23/435950.htmlhttp://www.aygfsteel.com/paulwong/comments/435950.htmlhttp://www.aygfsteel.com/paulwong/archive/2021/08/23/435950.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/435950.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/435950.html 默认是重?ơ,每次重试间隔?0U?br />
@SpringBootApplication
public class SpringIntegrationDslHttpRetryApplication {

    @SuppressWarnings("unchecked")
    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext =
                SpringApplication.run(SpringIntegrationDslHttpRetryApplication.class, args);
        Function<Object, Object> function = applicationContext.getBean(Function.class);
        function.apply("foo");
    }

    @Bean
    public IntegrationFlow httpRetryFlow() {
        return IntegrationFlows.from(Function.class)
                .handle(Http.outboundGateway("http://localhost:11111")
                                .httpMethod(HttpMethod.GET)
                                .expectedResponseType(String.class),
                        e -> e.advice(retryAdvice()))
                .get();
    }

    @Bean
    public RequestHandlerRetryAdvice retryAdvice() {
        return new RequestHandlerRetryAdvice();
    }

}

#打印日志
logging.level.org.springframework.retry=debug

Reference:
https://docs.spring.io/spring-integration/reference/html/handler-advice.html#retry-advice
https://stackoverflow.com/questions/49784360/configure-error-handling-and-retry-for-http-outboundgateway-spring-dsl
https://stackoverflow.com/questions/50262862/requesthandlerretryadvice-with-httprequestexecutingmessagehandler-not-working
https://stackoverflow.com/questions/63689856/spring-integration-http-outbound-gateway-retry-based-on-reply-content
https://blog.csdn.net/cunfen8879/article/details/112552420




paulwong 2021-08-23 13:01 发表评论
]]>
JSR-303 Bean Validationhttp://www.aygfsteel.com/paulwong/archive/2021/01/28/435786.htmlpaulwongpaulwongThu, 28 Jan 2021 02:35:00 GMThttp://www.aygfsteel.com/paulwong/archive/2021/01/28/435786.htmlhttp://www.aygfsteel.com/paulwong/comments/435786.htmlhttp://www.aygfsteel.com/paulwong/archive/2021/01/28/435786.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/435786.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/435786.html
JSR-303 Bean Validation则提供了q样的便捗?br />
只要在JAVA BEAN中需要验证的字段加@NotNullq种标签Q然后在SERVISE中的输入参数中加@Valid标签Q则激z验证流E?br />也可以编E的方式自己验证Q?br />
@MessageEndpoint
//@Validated
public class MqMessageCcdValidator {
    
    private static final Logger LOGGER = LoggerFactory.getLogger(MqMessageCcdValidator.class);
    
    @Autowired
    private Validator validator;
    
    @ServiceActivator
    public MqMessage<CcdRequest> validate(/* @Valid */ Message<MqMessage<CcdRequest>> requestMessage) {
        Set<ConstraintViolation<MqMessage<CcdRequest>>> set = validator.validate(requestMessage.getPayload());
        if(CollectionUtils.isNotEmpty(set)) {
            CompositeException compositeException = new CompositeException();
            set.forEach(
                constraintViolation -> {
                                            LOGGER.info("{}", constraintViolation);
                                            ReqInfoValidationException exception =
                                                    new ReqInfoValidationException(constraintViolation.getMessage());
                                            compositeException.addException(exception);
                                       }
            );
            throw new MessageHandlingException(requestMessage, compositeException);
        }
        
        return requestMessage.getPayload();
    }

}

自定义验证规?br />可用标签来做Q以下ؓ验证手机L规则Q?br />
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import javax.validation.Constraint;
import javax.validation.Payload;
import javax.validation.ReportAsSingleViolation;
import javax.validation.constraints.Pattern;

@Retention(RUNTIME)
@Target(value = { ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
@Constraint(validatedBy = {})
@ReportAsSingleViolation
@Pattern(regexp = "^1[3-9]\\d{9}$")
public @interface ChinaPhone {
    String message() default "Invalid Chinese mobile No.";
    Class<?>[] groups() default {};
    Class<? extends Payload>[] payload() default {};
}

如果比较复杂的验证规则,则参见:
https://reflectoring.io/bean-validation-with-spring-boot/#implementing-a-custom-validator

How to use Java Bean Validation in Spring Boot
https://nullbeans.com/how-to-use-java-bean-validation-in-spring-boot/

Complete Guide to Validation With Spring Boot
https://reflectoring.io/bean-validation-with-spring-boot/

Spring JMS Validate Messages using JSR-303 Bean Validation
https://memorynotfound.com/spring-jms-validate-messages-jsr-303-bean-validation/

Spring REST Validation Example
https://mkyong.com/spring-boot/spring-rest-validation-example/

Spring Boot 整合 Bean Validation 校验数据

https://blog.csdn.net/wangzhihao1994/article/details/108403732


paulwong 2021-01-28 10:35 发表评论
]]>
SPRING INTEGRATION SCATTERGATHERhttp://www.aygfsteel.com/paulwong/archive/2021/01/28/435785.htmlpaulwongpaulwongThu, 28 Jan 2021 02:11:00 GMThttp://www.aygfsteel.com/paulwong/archive/2021/01/28/435785.htmlhttp://www.aygfsteel.com/paulwong/comments/435785.htmlhttp://www.aygfsteel.com/paulwong/archive/2021/01/28/435785.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/435785.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/435785.html
  1. 食客下单Q有饮品、食物、甜?br />
  2. 侍应接单Q传送给厨房
  3. 厨房分三个子程处理Q即饮品、食物、甜点子程
  4. {待三个子流E处理完Q合q成一份交?
  5. 如果厨房发现某食物欠~,会通知侍应Q展开错误处理Q即通知食客更改食物Q再交给厨房
  6. 侍应交付品传送给食客
有一个主程、三个子程和一个聚合流E,聚合程会聚合三个子程的物,通知LE,再往下走?br />q且LE会感知子流E的错误Qƈ会交l相应错误处理流E处理,且将l果再交l聚合流E?br />
对应SPRING INTEGRATION 的SCATTERGATHER模式Q?br />
@Bean
public IntegrationFlow scatterGatherAndExecutorChannelSubFlow(TaskExecutor taskExecutor) {
    return f -> f
            .scatterGather(
                    scatterer -> scatterer
                            .applySequence(true)
                            .recipientFlow(f1 -> f1.transform(p -> "Sub-flow#1"))
                            .recipientFlow(f2 -> f2
                                    .channel(c -> c.executor(taskExecutor))
                                    .transform(p -> {
                                        throw new RuntimeException("Sub-flow#2");
                                    })),
                    null,
                    s -> s.errorChannel("scatterGatherErrorChannel"));
}

@ServiceActivator(inputChannel = "scatterGatherErrorChannel")
public Message<?> processAsyncScatterError(MessagingException payload) {
    return MessageBuilder.withPayload(payload.getCause().getCause())
            .copyHeaders(payload.getFailedMessage().getHeaders())
            .build();
}

https://github.com/adnanmamajiwala/spring-integration-sample/tree/master/dsl-scatter-gather/src/main/java/com/si/dsl/scattergather

https://docs.spring.io/spring-integration/docs/5.1.x/reference/html/#scatter-gather

paulwong 2021-01-28 10:11 发表评论
]]>
SPRING INTEGRATION HEADER问题http://www.aygfsteel.com/paulwong/archive/2020/10/20/435696.htmlpaulwongpaulwongTue, 20 Oct 2020 06:56:00 GMThttp://www.aygfsteel.com/paulwong/archive/2020/10/20/435696.htmlhttp://www.aygfsteel.com/paulwong/comments/435696.htmlhttp://www.aygfsteel.com/paulwong/archive/2020/10/20/435696.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/435696.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/435696.html
.headerFilter("Api-Key", "Content-Type", "X-Powered-By", "Content-Language", "Transfer-Encoding", "Cache-Control", "Keep-Alive", "Set-Cookie")

https://stackoverflow.com/questions/50608415/cwsia0112e-the-property-name-keep-alive-is-not-a-valid-java-identifier

paulwong 2020-10-20 14:56 发表评论
]]>
Error handling in spring integration - How to get all the errors thrown in multiple threads and send them to the error-channelhttp://www.aygfsteel.com/paulwong/archive/2020/10/15/435693.htmlpaulwongpaulwongThu, 15 Oct 2020 11:21:00 GMThttp://www.aygfsteel.com/paulwong/archive/2020/10/15/435693.htmlhttp://www.aygfsteel.com/paulwong/comments/435693.htmlhttp://www.aygfsteel.com/paulwong/archive/2020/10/15/435693.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/435693.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/435693.html
@Bean
public IntegrationFlow provisionUserFlow() {
return
    IntegrationFlows.from("input.channel")
    .publishSubscribeChannel(Executors.newCachedThreadPool(),
        s -> s.applySequence(true)
            .subscribe(f -> f.enrichHeaders(e -> e.header(MessageHeaders.ERROR_CHANNEL, "errorChannel", true))
                .handle(provisionerA, "provision")
                .channel("aggregatorChannel")
            )
            .subscribe(f -> f.enrichHeaders(e -> e.header(MessageHeaders.ERROR_CHANNEL, "errorChannel", true))
                .handle(provisionerB, "provision")
                .channel("aggregatorChannel"))
            )
        .get();
}

@Bean
public IntegrationFlow aggregateFlow() {
    return IntegrationFlows.from("aggregatorChannel")
                    .channel( aggregatorChannel)
                    .aggregate( a -> a.processor( collect, "aggregatingMethod"))
                    .get();
}

@Transformer( inputChannel = "errorChannel", outputChannel = "aggregatorChannel")
public Message<?> errorChannelHandler(ErrorMessage errorMessage) throws RuntimeException {

    Message<?> failedMessage =  ((MessagingException) errorMessage.getPayload()).getFailedMessage();

    Exception exception = (Exception) errorMessage.getPayload();

    return  MessageBuilder.withPayload( exception.getMessage())
                                       .copyHeadersIfAbsent( failedMessage.getHeaders() )
                                       .build();
}


https://stackoverflow.com/q/46495127/11790720



paulwong 2020-10-15 19:21 发表评论
]]>
SPRING INTEGRATION子FLOWhttp://www.aygfsteel.com/paulwong/archive/2020/10/15/435692.htmlpaulwongpaulwongThu, 15 Oct 2020 03:29:00 GMThttp://www.aygfsteel.com/paulwong/archive/2020/10/15/435692.htmlhttp://www.aygfsteel.com/paulwong/comments/435692.htmlhttp://www.aygfsteel.com/paulwong/archive/2020/10/15/435692.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/435692.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/435692.html split之后Q可以将message分给不同的子flow处理Q配|如下:
@Bean
public IntegrationFlow parallelSplitRouteAggregateFlow() {
    return IntegrationFlows
            .from(Http.inboundGateway("/trigger"))
            .handle((p, h) -> Arrays.asList(1, 2, 3))
            .split()
            .channel(MessageChannels.executor(Executors.newCachedThreadPool()))
            .<Integer, Boolean>route(o -> o % 2 == 0, m -> m
                    .subFlowMapping(true, sf -> sf.gateway(oddFlow()))
                    .subFlowMapping(false, sf -> sf.gateway(evenFlow())))
            .aggregate()
            .get();
}

@Bean
public IntegrationFlow oddFlow() {
    return flow -> flow.<Integer>handle((payload, headers) -> "odd");
}

@Bean
public IntegrationFlow evenFlow() {
    return flow -> flow.<Integer>handle((payload, headers) -> "even");
}


https://stackoverflow.com/questions/50121384/spring-integration-parallel-split-route-aggregate-flow-fails-due-to-one-way-mess

paulwong 2020-10-15 11:29 发表评论
]]>
SPRING INTEGRATION ERROR HANDLINGhttp://www.aygfsteel.com/paulwong/archive/2020/01/10/435027.htmlpaulwongpaulwongFri, 10 Jan 2020 07:32:00 GMThttp://www.aygfsteel.com/paulwong/archive/2020/01/10/435027.htmlhttp://www.aygfsteel.com/paulwong/comments/435027.htmlhttp://www.aygfsteel.com/paulwong/archive/2020/01/10/435027.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/435027.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/435027.htmlhttps://github.com/zakyalvan/spring-integration-java-dsl-learn

package com.jwebs.learn.errorhandling;

import java.util.Random;

import javax.jms.ConnectionFactory;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.integration.annotation.IntegrationComponentScan;
import org.springframework.integration.channel.PublishSubscribeChannel;
import org.springframework.integration.core.MessageSource;
import org.springframework.integration.dsl.IntegrationFlow;
import org.springframework.integration.dsl.IntegrationFlows;
import org.springframework.integration.dsl.core.Pollers;
import org.springframework.integration.dsl.jms.Jms;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.messaging.MessagingException;

/**
 * Show how to handle error in spring integration flow.
 * Please note, errorChannel in spring integration only applicable to
 * error thrown in asynch component.
 * 
 * 
@author zakyalvan
 
*/
@SpringBootApplication
@IntegrationComponentScan
public class ErrorHandlingApplication {
    public static void main(String[] args) throws Exception {
        ConfigurableApplicationContext applicationContext = new SpringApplicationBuilder(ErrorHandlingApplication.class)
                .web(false)
                .run(args);
        
        Runtime.getRuntime().addShutdownHook(new Thread(() -> applicationContext.close()));
        
        System.out.println("Pres enter key to exit");
        System.in.read();
        System.exit(0);
    }

    @Autowired
    private ConnectionFactory connectionFactory;
    
    @Bean
    public MessageSource<Integer> randomIntegerMessageSource() {
        return () -> MessageBuilder.withPayload(new Random().nextInt()).build();
    }
    
    @Bean
    public IntegrationFlow withErrorFlow() {
        return IntegrationFlows.from(randomIntegerMessageSource(), spec -> spec.poller(Pollers.fixedDelay(1000)))
                    .handle(Jms.outboundGateway(connectionFactory)
                    .requestDestination("processor.input")
                    .replyContainer(spec -> spec.sessionTransacted(true)))
                    .get();
    }
    
    @Autowired
    @Qualifier("errorChannel")
    private PublishSubscribeChannel errorChannel;
    
    @Bean
    public IntegrationFlow errorHandlingFlow() {
        return IntegrationFlows.from(errorChannel)
                .handle(message -> System.out.println("@@@@@@@@@@@@@@@@@@@@@" + ((MessagingException) message.getPayload()).getFailedMessage().getPayload()))
                .get();
    }
}


paulwong 2020-01-10 15:32 发表评论
]]>
EIP in SPRING INTEGRATIONhttp://www.aygfsteel.com/paulwong/archive/2019/10/25/434882.htmlpaulwongpaulwongFri, 25 Oct 2019 03:03:00 GMThttp://www.aygfsteel.com/paulwong/archive/2019/10/25/434882.htmlhttp://www.aygfsteel.com/paulwong/comments/434882.htmlhttp://www.aygfsteel.com/paulwong/archive/2019/10/25/434882.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/434882.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/434882.html
  • idempotent receiver
q等型,同一个MESSAGEQ如MESSAGE ID都一P在MESSAGINGpȝ中不运行多次Q结果都一P为啥Q因为重复的MESSAGEQ都被忽略了?br /> ҎQ?br /> 消息被处理后Q从消息中取出IDQ放入META-DATA-STORE中,后箋处理消息Ӟ要从META-DATA-STORE中检查是否有倹{?br />
下面q个ҎQID的存储和判断是否重复消息都在一个INTERCEPTOR中搞定?br /> https://stackoverflow.com/questions/50401460/spring-integration-dsl-configure-idempotent-receiver-to-identify-duplicates
https://www.javacodegeeks.com/2015/09/monitoring-and-management.html


claim-check
MESSAGE的PAYLOAD存在STORE中,q回一个IDQ这个ID即claim-checkQ如果需要取MESSAGE的DETAIlӞ可从STORE中取出MESSAGE?br />https://github.com/spring-projects/spring-integration/blob/master/src/reference/asciidoc/claim-check.adoc




paulwong 2019-10-25 11:03 发表评论
]]>
SPRING INTEGRATION LESSONShttp://www.aygfsteel.com/paulwong/archive/2019/10/25/434881.htmlpaulwongpaulwongFri, 25 Oct 2019 01:45:00 GMThttp://www.aygfsteel.com/paulwong/archive/2019/10/25/434881.htmlhttp://www.aygfsteel.com/paulwong/comments/434881.htmlhttp://www.aygfsteel.com/paulwong/archive/2019/10/25/434881.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/434881.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/434881.htmlLessons

Introduction to Enterprise Application Integration

In our first lesson, you will get introduced to the concepts of Enterprise Application Integration. You will learn about the and Enterprise integration patterns that can be applied to simplify integration between different platforms and the Integration strategies that can be followed for this purpose. Finally, we will discuss how and why to implement a Message driven architecture and how to achieve both Synchronous and asynchronous communication among nodes.

Spring Integration Fundamentals

In this lesson, you will get to understand how Spring Integration works under the hood. The core concepts of Spring Integration messaging system (like message channels and endpoints) will be introduced. Additionally, the components that build the framework will be discussed, including the channel adapters, transformers, filters, routers etc. Finally, the two distinct methods of communication (synchronous and asynchronous) are explained and the lesson ends with a discussion on error handling.

Spring Integration and Web Services

In this lesson, we will focus on the integration with external web services. Spring Integration comes with the necessary functionality (adapters, channels etc.) to support web services out of the box. A full example is built from scratch in order to better understand the topic.

Enterprise Messaging

In this lesson, we will focus on integrating our application with JMS messaging. For this purpose, we will use Active MQ, which will be our broker. We will show examples of sending and receiving JMS messages by using the Spring Integration JMS channel adapters. Following these examples, we will see some ways of customizing these invocations by configuring message conversion and destination resolution.

Spring Integration Full Example

In this lesson, we will wrap everything up by providing a complete application that uses several of the components provided by Spring Integration in order to provide a service to its users. We will discuss the system architecture, the actual implementation and the relevant error handling.

Monitoring and Management

In this lesson, we will examine different mechanisms of monitoring or gathering more information about what is going on within the messaging system. Some of these mechanisms consist of managing or monitoring the application through MBeans, which are part of the JMX specification. Another mechanism discussed in this chapter is how we will implement the EIP idempotent receiver pattern using a metadata store. Finally, the last mechanism described is the control bus. This will let us send messages that will invoke operations on components in the application context.



paulwong 2019-10-25 09:45 发表评论
]]>
SPRING INTEGRATION DSL DEMOhttp://www.aygfsteel.com/paulwong/archive/2019/10/23/434878.htmlpaulwongpaulwongWed, 23 Oct 2019 03:55:00 GMThttp://www.aygfsteel.com/paulwong/archive/2019/10/23/434878.htmlhttp://www.aygfsteel.com/paulwong/comments/434878.htmlhttp://www.aygfsteel.com/paulwong/archive/2019/10/23/434878.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/434878.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/434878.htmlhttps://github.com/spring-projects/spring-integration/tree/master/src/reference/asciidoc

paulwong 2019-10-23 11:55 发表评论
]]>
Spring Integration 中文手册 - GOODhttp://www.aygfsteel.com/paulwong/archive/2019/10/11/434799.htmlpaulwongpaulwongFri, 11 Oct 2019 02:28:00 GMThttp://www.aygfsteel.com/paulwong/archive/2019/10/11/434799.htmlhttp://www.aygfsteel.com/paulwong/comments/434799.htmlhttp://www.aygfsteel.com/paulwong/archive/2019/10/11/434799.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/434799.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/434799.htmlSpring Integration 中文手册 (1)


Spring Integration 中文手册 (2)

paulwong 2019-10-11 10:28 发表评论
]]>
在SPRING INTEGRATION中手动开始和停止JMS LISTENERhttp://www.aygfsteel.com/paulwong/archive/2019/10/09/434781.htmlpaulwongpaulwongWed, 09 Oct 2019 09:16:00 GMThttp://www.aygfsteel.com/paulwong/archive/2019/10/09/434781.htmlhttp://www.aygfsteel.com/paulwong/comments/434781.htmlhttp://www.aygfsteel.com/paulwong/archive/2019/10/09/434781.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/434781.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/434781.html
SPRING INTEGRATION是实CEIP模式的一U框Ӟ即用CHANNEL和JMS-INBOUND-ADAPTER、JMS-OUTBOUND-ADAPTERQ完全脱MJmsTemplate的API?br />
如果需要实现这U场景:从BROKER取一条消息,处理消息Q且处理途中不要再从BROKER再取消息Q处理完后再取消息,再处理?br />
q样要求手动开始和停止JMS LISTENERQ即手动开始和停止JMS-INBOUND-ADAPTER、JMS-OUTBOUND-ADAPTER?br />
@Bean
@InboundChannelAdapter(value = "loaderResponseChannel")
public MessageSource loaderResponseSource() throws Exception {
    return Jms
            .inboundAdapter(oracleConnectionFactory())
            .configureJmsTemplate(
                    t -> t.deliveryPersistent(true)
                            .jmsMessageConverter(jacksonJmsMessageConverter())
            ).destination(jmsInbound).get();
}

当用@InboundChannelAdapterӞ会自动注册一个SourcePollingChannelAdapter Q但q个名字比较长:configrationName.loaderResponseSource.inboundChannelAdapter?br />
呼叫q个实例的start()和stop()Ҏ卛_?br />
@Bean
public IntegrationFlow controlBusFlow() {
    return IntegrationFlows.from("controlBus")
              .controlBus()
              .get();
}

Message operation = MessageBuilder.withPayload("@configrationName.loaderResponseSource.inboundChannelAdapter.start()").build();
operationChannel.send(operation)

https://stackoverflow.com/questions/45632469/shutdown-spring-integration-with-jms-inboundadapter

https://docs.spring.io/spring-integration/docs/5.0.7.RELEASE/reference/html/system-management-chapter.html#control-bus

https://github.com/spring-projects/spring-integration-java-dsl/blob/master/src/test/java/org/springframework/integration/dsl/test/jms/JmsTests.java

https://stackoverflow.com/questions/50428552/how-to-stop-or-suspend-polling-after-batch-job-fail


paulwong 2019-10-09 17:16 发表评论
]]>
Enterprise Integration Patternshttp://www.aygfsteel.com/paulwong/archive/2019/07/18/434231.htmlpaulwongpaulwongThu, 18 Jul 2019 06:11:00 GMThttp://www.aygfsteel.com/paulwong/archive/2019/07/18/434231.htmlhttp://www.aygfsteel.com/paulwong/comments/434231.htmlhttp://www.aygfsteel.com/paulwong/archive/2019/07/18/434231.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/434231.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/434231.htmlWhy Enterprise Integration Patterns?

Enterprise integration is too complex to be solved with a simple 'cookbook' approach. Instead, patterns can provide guidance by documenting the kind of experience that usually lives only in architects' heads: they are accepted solutions to recurring problems within a given context. Patterns are abstract enough to apply to most integration technologies, but specific enough to provide hands-on guidance to designers and architects. Patterns also provide a vocabulary for developers to efficiently describe their solution.

Patterns are not 'invented'; they are harvested from repeated use in practice. If you have built integration solutions, it is likely that you have used some of these patterns, maybe in slight variations and maybe calling them by a different name. The purpose of this site is not to "invent" new approaches, but to present a coherent collection of relevant and proven patterns, which in total form an integration pattern language.

Despite the 700+ pages, our book covers only a fraction of patterns (and the problems to be solved) in the integration space. The current patterns focus on Messaging, which forms the basis of most other integration patterns. We have started to harvest more patterns but are realizing (once again) how much work documenting these patterns really is. So please stay tuned.

Messaging Patterns

We have documented 65 messaging patterns, organized as follows:



https://www.enterpriseintegrationpatterns.com/patterns/messaging/index.html

paulwong 2019-07-18 14:11 发表评论
]]>
SPRING BATCH & SPRING INTEGRATION TUTORIALhttp://www.aygfsteel.com/paulwong/archive/2019/07/18/434230.htmlpaulwongpaulwongThu, 18 Jul 2019 05:21:00 GMThttp://www.aygfsteel.com/paulwong/archive/2019/07/18/434230.htmlhttp://www.aygfsteel.com/paulwong/comments/434230.htmlhttp://www.aygfsteel.com/paulwong/archive/2019/07/18/434230.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/434230.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/434230.html

Spring JMS Artemis Example 6 minute read

A detailed step-by-step tutorial on how to connect to Apache ActiveMQ Artemis using Spring JMS and Spring Boot.

Spring JMS Topic Example 5 minute read

A detailed step-by-step tutorial on how to publish/subscribe to a JMS topic using Spring JMS and Spring Boot.

Spring JMS Integration Example12 minute read

A detailed step-by-step tutorial on how to connect to an ActiveMQ JMS broker using Spring Integration and Spring Boot.

Spring JMS Listener Example 7 minute read

A detailed step-by-step tutorial on how a Spring JMS listener works in combination with Spring Boot.

Spring JMS JmsTemplate Example 7 minute read

A detailed step-by-step tutorial on how to use JmsTemplate in combination with Spring JMS and Spring Boot.

Spring JMS Message Converter Example5 minute read

A detailed step-by-step tutorial on how to implement a message converter using Spring JMS and Spring Boot.

Spring Batch Admin Example 11 minute read

A detailed step-by-step tutorial on how to use a Spring Boot admin UI to manage Spring Batch jobs.

Spring Batch Example 11 minute read

A detailed step-by-step tutorial on how to implement a Hello World Spring Batch job using Spring Boot.



paulwong 2019-07-18 13:21 发表评论
]]>
Spring Integration Java DSLhttp://www.aygfsteel.com/paulwong/archive/2019/07/18/434229.htmlpaulwongpaulwongThu, 18 Jul 2019 05:16:00 GMThttp://www.aygfsteel.com/paulwong/archive/2019/07/18/434229.htmlhttp://www.aygfsteel.com/paulwong/comments/434229.htmlhttp://www.aygfsteel.com/paulwong/archive/2019/07/18/434229.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/434229.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/434229.htmlThis time I decided to play a little bit with Spring Integration Java DSL. Which has been merged directly into Spring Integration Core 5.0, which is smart and obvious move because:

  • Everyone starting the new Spring projects based on Java Config uses that
  • SI Java DSL enables you to use new powerfull Java 8 features like Lambdas
  • You can build your flow using the Builder pattern based on IntegrationFlowBuilder

Let's take a look on the samples howto use that based on ActiveMQ JMS.


https://bitbucket.org/tomask79/spring-integration-java-dsl/src/master/



paulwong 2019-07-18 13:16 发表评论
]]>
Message Processing With Spring Integrationhttp://www.aygfsteel.com/paulwong/archive/2019/06/05/433840.htmlpaulwongpaulwongWed, 05 Jun 2019 03:08:00 GMThttp://www.aygfsteel.com/paulwong/archive/2019/06/05/433840.htmlhttp://www.aygfsteel.com/paulwong/comments/433840.htmlhttp://www.aygfsteel.com/paulwong/archive/2019/06/05/433840.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/433840.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/433840.html
https://dzone.com/articles/message-processing-spring



paulwong 2019-06-05 11:08 发表评论
]]>
Spring integration 基本概念http://www.aygfsteel.com/paulwong/archive/2019/06/05/433839.htmlpaulwongpaulwongWed, 05 Jun 2019 02:36:00 GMThttp://www.aygfsteel.com/paulwong/archive/2019/06/05/433839.htmlhttp://www.aygfsteel.com/paulwong/comments/433839.htmlhttp://www.aygfsteel.com/paulwong/archive/2019/06/05/433839.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/433839.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/433839.html

1.spring integration 's architecture

主要提供两个功能Q?/p>

在系l内提供实现轻量U、事仉动交互行为的框架

在系l间提供一U基于适配器的q_Q以支持灉|的系l间交互

2.spring integration对于企业集成模式的支?/p>

2.1MessageQ一个信息的单元Q通常有消息头QheaderQ和消息内容QpayloadQ组?/p>

2.2Message channelQ消息处理节点之间的q接Q负责将Message从生产者传输到消费者?/p>

    Ҏ消费者的多少Q可分ؓpoint to point和publish-subscribe两种


    Ҏ消息传输方式的不同,分ؓ同步和异步两U?/p>

2.3Message EndpointQ消息处理节点,消息从节点进入通道Q也是从节点d通道

几个常见的Message EndPointQ?/p>

CHANNEL ADAPTERQ用于连接该适配器的特点是单向消息流的,要么是消息通过该适配器进入通道Q要么是消息通过该适配器离开通道


MESSAGING GATEWAYQ处理的消息和Channel Adapter不同Q不是单向的Q即有进入该节点的消息,也会从该节点发出消息?br />



SERVICE ACTIVATORQ该节点调用服务来处理输入的消息Qƈ服务返回的数据发送到输出通道。在spring integration中,调用的方法被限定为本地方法调用?br />


ROUTERQ\由器Q将输入的消息\由到某个输出通道?/p>


SPLITTERQ将输入的消息拆分成子消?br />


AGGREGATORQ将输入的多个消息合qؓ一个消?br />


3.观看书中例子hello-world思?/p>

试gatewayӞ下面代码向通道names内放入消息worldQ?/p>


然后service-activator从names通道中获得消息worldQ调用方法sayHelloq回值到lgatewayQ?/p>

解释Qgateway有一个serviceQinterface的属性,q个属性指向一个interface。当我们用一个接口声明一个gatewayӞspring integration会自动帮我们生成该接口的代理c,q样当我们往gateway发送消息时Qspring integration会通过代理cL消息转发到defaultQrequestQchannel中去



作者:马国?br /> 链接Qhttps://www.jianshu.com/p/bf1643539f99
来源Q简?br /> 书著作权归作者所有,M形式的{载都误pM者获得授权ƈ注明出处?/div>

paulwong 2019-06-05 10:36 发表评论
]]>
如何在SPRING INTEGRATION中用事?/title><link>http://www.aygfsteel.com/paulwong/archive/2019/06/04/433836.html</link><dc:creator>paulwong</dc:creator><author>paulwong</author><pubDate>Tue, 04 Jun 2019 06:19:00 GMT</pubDate><guid>http://www.aygfsteel.com/paulwong/archive/2019/06/04/433836.html</guid><wfw:comment>http://www.aygfsteel.com/paulwong/comments/433836.html</wfw:comment><comments>http://www.aygfsteel.com/paulwong/archive/2019/06/04/433836.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/paulwong/comments/commentRss/433836.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/paulwong/services/trackbacks/433836.html</trackback:ping><description><![CDATA[<div>File Polling using the Spring Integration DSL</div> <a target="_blank">http://porterhead.blogspot.com/2016/07/file-polling-using-spring-integration.html</a> <br /><a target="_blank"><br />https://github.com/iainporter/spring-file-poller</a><br /><br /><br />Transaction Support in Spring Integration<br /><a target="_blank">https://www.baeldung.com/spring-integration-transaction</a><img src ="http://www.aygfsteel.com/paulwong/aggbug/433836.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/paulwong/" target="_blank">paulwong</a> 2019-06-04 14:19 <a href="http://www.aygfsteel.com/paulwong/archive/2019/06/04/433836.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用JAMES实现自己的邮件服务器http://www.aygfsteel.com/paulwong/archive/2012/12/16/393057.htmlpaulwongpaulwongSun, 16 Dec 2012 05:14:00 GMThttp://www.aygfsteel.com/paulwong/archive/2012/12/16/393057.htmlhttp://www.aygfsteel.com/paulwong/comments/393057.htmlhttp://www.aygfsteel.com/paulwong/archive/2012/12/16/393057.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/393057.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/393057.html ?br /> James 是一个企业的邮件服务器Q它完全实现了smtp ?pops 以及nntp 协议。同Ӟjames服务器又是一个邮件应用程序^台。James的核心是Mailet API,而james 服务齐是一个mailet的容器。它可以让你非常Ҏ的实现出很强大的邮g应用E序。James开源项目被q泛的应用于与邮件有关的目中。你可以通过它来搭徏自己的邮件服务器。我们可以利用Mailet API,~程接口来实现自己所需的业务。James集成了Avalon 应用E序框架以及Phoenix Avalon 框架容器。Phoenix为james 服务器提供了强大的支持。需要说明的是Avalon开源项目目前已l关闭?br /> 快速上?br /> 安装james
我这ơ用的安装包是james 2.3.1。大家可以从q里下蝲到http://james.apache.org/download.cgi
现在让我们开始我们激动h心的james之旅。首先我们将james-binary-2.3.1.zip解压~下载到你的安装目录。我们可以把q个q程理解为安装的q程。我在这里将它解压到c:\.q且把它改名为james.q样我们的james安装好了。目录ؓC:\james。很单吧Q?br />
准备知识 Q?学习一些必要的知识
在我使用james的时候让我感觉首先理解james的应用程序结构是很重要的。否则你会在使用中感到很困惑?br /> 它的应用E序l构是这LQ?br /> James
|_ _apps
|_ _bin
|_ _conf
|_ _ext
|_ _lib
|_ _logs
|_ _tools
我们重点介绍一下两个文件夹bin ?apps.
bin目录中的run.bat和run.sh是James的启动程序。只要记住这个重要文件就可以?br /> 启动之后控制台显C如下:
Using PHOENIX_HOME: C:\james
Using PHOENIX_TMPDIR: C:\james\temp
Using JAVA_HOME: C:\j2sdk1.4.2_02
Phoenix 4.2
James Mail Server 2.3.1
Remote Manager Service started plain:4555
POP3 Service started plain:110
SMTP Service started plain:25
NNTP Service started plain:119
FetchMail Disabled
Apps 目录下有个james的子目录q个目录是它的核心?br /> james
|_ _SAR-INF
|_ _conf
|_ _logs
|_ _var
|_mail
|_address-error
|_error
|_indexes
|_outgoing
|_relay-denied
|_spam
|_spool
|_nntp
|_....

|_users
SAR-INF 下有一个config.xml是james中的核心配置文g?br /> Logs 包含了与james有关的Log。调试全靠它了?br /> Var 包含了一些文件夹通过它们的名字我们大概也能猜出它们的用途。Mail主要用于存储邮g。nntp主要用于新闻服务器。Users用于存储所有邮件服务器的用戗也是邮g地址前面的东东。如Qpig@sina.com的pig是所谓用用户?br />
创徏用户Q?br /> 我们在James上徏若干用户Q用来测试收发邮件。当然如果你不用james本n的用户也可以。James以telnet 的方式提供了接口用来d用户。下面我来演CZ下?br /> 首先使用telnet来连接james的remote manager .
1.telnet localhost 4555 回R
2.然后输入理员用户名和密码(user/pwd Q?root/root 是默认设|这个可以在config.xml中修改)
JAMES Remote Administration Tool 2.3.1
Please enter your login and password
Login id:
root
Password:
root
Welcome root. HELP for a list of commands

3.d用户
adduser kakaxi kakaxi
User kakaxi added

Adduser mingren mingren
User mingren added

4.查看d情况
listusers
Existing accounts 2
user: mingren
user: kakaxi
得到上面的信息说明我们已l添加成功?br />

发送器
q个cM要用来测试我们的邮g服务器,可以不用其打入包中?br /> java 代码 
package com.paul.jamesstudy;   
  
import java.util.Date;   
import java.util.Properties;   
  
import javax.mail.Authenticator;   
import javax.mail.Message;   
import javax.mail.PasswordAuthentication;   
import javax.mail.Session;   
import javax.mail.Transport;   
import javax.mail.internet.InternetAddress;   
import javax.mail.internet.MimeMessage;   
  
public class Mail {   
    private String mailServer, From, To, mailSubject, MailContent;   
  
    private String username, password;   
  
    private Session mailSession;   
  
    private Properties prop;   
  
    private Message message;   
  
    // Authenticator auth;//认证   
    public Mail() {   
        // 讄邮g相关   
        username = "kakaxi";   
        password = "kakaxi";   
        mailServer = "localhost";   
        From = "kakaxi@localhost";   
        To = "mingren@localhost";   
        mailSubject = "Hello Scientist";   
        MailContent = "How are you today!";   
    }   
    public void send(){   
        EmailAuthenticator mailauth =    
new EmailAuthenticator(username, password);   
        // 讄邮g服务?nbsp;  
        prop = System.getProperties();   
        prop.put("mail.smtp.auth", "true");   
        prop.put("mail.smtp.host", mailServer);   
        // 产生新的Session服务   
        mailSession = mailSession.getDefaultInstance(prop,   
                (Authenticator) mailauth);   
        message = new MimeMessage(mailSession);   
  
        try {   
        message.setFrom(new InternetAddress(From)); // 讄发g?nbsp;  
        message.setRecipient(Message.RecipientType.TO,    
new InternetAddress(To));// 讄收g?nbsp;  
        message.setSubject(mailSubject);// 讄主题   
        message.setContent(MailContent, "text/plain");// 讄内容   
        message.setSentDate(new Date());// 讄日期   
        Transport tran = mailSession.getTransport("smtp");   
        tran.connect(mailServer, username, password);   
        tran.send(message, message.getAllRecipients());   
        tran.close();   
        } catch (Exception e) {   
            e.printStackTrace();   
        }   
    }   
    public static void main(String[] args) {   
        Mail mail;   
        mail = new Mail();   
        System.out.println("sending");   
        mail.send();   
        System.out.println("finished!");   
    }   
  
}   
  
class EmailAuthenticator extends Authenticator {   
    private String m_username = null;   
  
    private String m_userpass = null;   
  
    void setUsername(String username) {   
        m_username = username;   
    }   
  
    void setUserpass(String userpass) {   
        m_userpass = userpass;   
    }   
  
    public EmailAuthenticator(String username, String userpass) {   
        super();   
        setUsername(username);   
        setUserpass(userpass);   
    }   
  
    public PasswordAuthentication getPasswordAuthentication() {   
        return new PasswordAuthentication(m_username, m_userpass);   
    }   
}   




paulwong 2012-12-16 13:14 发表评论
]]>
SRING INTEGRATION + BATCHhttp://www.aygfsteel.com/paulwong/archive/2012/10/21/389968.htmlpaulwongpaulwongSun, 21 Oct 2012 09:23:00 GMThttp://www.aygfsteel.com/paulwong/archive/2012/10/21/389968.htmlhttp://www.aygfsteel.com/paulwong/comments/389968.htmlhttp://www.aygfsteel.com/paulwong/archive/2012/10/21/389968.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/389968.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/389968.html阅读全文

paulwong 2012-10-21 17:23 发表评论
]]>
spring integration同步数据库数?/title><link>http://www.aygfsteel.com/paulwong/archive/2012/10/17/389716.html</link><dc:creator>paulwong</dc:creator><author>paulwong</author><pubDate>Wed, 17 Oct 2012 03:50:00 GMT</pubDate><guid>http://www.aygfsteel.com/paulwong/archive/2012/10/17/389716.html</guid><wfw:comment>http://www.aygfsteel.com/paulwong/comments/389716.html</wfw:comment><comments>http://www.aygfsteel.com/paulwong/archive/2012/10/17/389716.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.aygfsteel.com/paulwong/comments/commentRss/389716.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/paulwong/services/trackbacks/389716.html</trackback:ping><description><![CDATA[     摘要: 需求ؓQ当客户已有pȝ的数据被同步到我Ҏ据库后,若再有新数据Q只同步新数据到我方数据库。解冻I因ؓ客户的业务表是不能变动的Q我方在客户数据库中新徏一状态表Q记录哪些数据被更新q。当客户业务表有新数据插入时Q用触发器将新数据id插入到状态表。ؓ方便实例Q业务表ppQ状态表statusl构为:ppQ? Code highlighting produced by Actipro CodeHighli...  <a href='http://www.aygfsteel.com/paulwong/archive/2012/10/17/389716.html'>阅读全文</a><img src ="http://www.aygfsteel.com/paulwong/aggbug/389716.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/paulwong/" target="_blank">paulwong</a> 2012-10-17 11:50 <a href="http://www.aygfsteel.com/paulwong/archive/2012/10/17/389716.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SPRING INTEGRATION + SPRING BATCHhttp://www.aygfsteel.com/paulwong/archive/2012/10/16/389625.htmlpaulwongpaulwongMon, 15 Oct 2012 16:11:00 GMThttp://www.aygfsteel.com/paulwong/archive/2012/10/16/389625.htmlhttp://www.aygfsteel.com/paulwong/comments/389625.htmlhttp://www.aygfsteel.com/paulwong/archive/2012/10/16/389625.html#Feedback7http://www.aygfsteel.com/paulwong/comments/commentRss/389625.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/389625.html阅读全文

paulwong 2012-10-16 00:11 发表评论
]]>
SPRING INTERGRATION资源http://www.aygfsteel.com/paulwong/archive/2012/06/11/380483.htmlpaulwongpaulwongMon, 11 Jun 2012 02:07:00 GMThttp://www.aygfsteel.com/paulwong/archive/2012/06/11/380483.htmlhttp://www.aygfsteel.com/paulwong/comments/380483.htmlhttp://www.aygfsteel.com/paulwong/archive/2012/06/11/380483.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/380483.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/380483.html http://wangleifire.iteye.com/blog/351749



paulwong 2012-06-11 10:07 发表评论
]]>
SPRING INTERGRATIONhttp://www.aygfsteel.com/paulwong/archive/2012/06/11/380482.htmlpaulwongpaulwongMon, 11 Jun 2012 02:04:00 GMThttp://www.aygfsteel.com/paulwong/archive/2012/06/11/380482.htmlhttp://www.aygfsteel.com/paulwong/comments/380482.htmlhttp://www.aygfsteel.com/paulwong/archive/2012/06/11/380482.html#Feedback0http://www.aygfsteel.com/paulwong/comments/commentRss/380482.htmlhttp://www.aygfsteel.com/paulwong/services/trackbacks/380482.html处理业务的程拆分成一个一个链Q前面处理完Q再z下一个,cMHTTP中的FILTER
不用安装服务器,内嵌在SPRING容器中,对外支持多种格式的数据,外部pȝ如要和SPRING INTERGRATION整合Q不需要再q行开?br />处理程一般就是,ADAPTER去读取外部数据,转换后放到CHANNEL中,ENDPOINT处理CHANNEL中的数据Q委z下一个CHANNELQ下一个ENDPOINT处理Q通过ADAPTER写到外部接口中?br />
  1. ADAPTER
    外部pȝ与CHANNEL之间的桥梁,获取外部数据其攑ֈCHANNEL去,有FTPQJMSQ文件系l的

  2. CHANNEL
    里面放MESSAGE对象QMESSAGE里面可以放自定义对象Q以提供消费者?br />
  3. ENDPOINT
    CHANNEL的消费者,CHANNEL与ENDPOINT是一对一的关p,所以如果想在一个CHANNE下对应多个ENDPOINTQ是做不到的Q只能增加CHANNEL

    Service ActivatorsQ从INPUT CHANNEL中取Z个对象作为参敎ͼ调用讄的POJO的方法,结果放到OUTPUT CHANNEL?br />TransformersQ对CHANNEL中的对象q行cd转换
    军_向的ENDPOINTQRoutersQSPLITER

  4. 例子
<?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.xsd
            http://www.springframework.org/schema/integration
            http://www.springframework.org/schema/integration/spring-integration.xsd
            http://www.springframework.org/schema/integration/stream
            http://www.springframework.org/schema/integration/stream/spring-integration-stream.xsd"
>

    
<gateway id="cafe" service-interface="org.springframework.integration.samples.cafe.Cafe"/>

    
<channel id="orders"/>
    
<!-- 此处orders里面的对象是一个一个MessageQ调用payload则取到Order
         调用items则得到OrderItem ListQ拆分成OrderItem以一个ؓ单位攑ֈ
         drinks?br />     
-->
    
<splitter input-channel="orders" expression="payload.items" output-channel="drinks"/>

    
<channel id="drinks"/>
    
<!-- 此处drinks里面的对象是一个一个OrderItemQ调用iced则取到布?br />         如果是true则放到coldDrinks中,如是false则放到hotDrinks?br />     -->
    
<router input-channel="drinks"  expression="payload.iced ? 'coldDrinks' : 'hotDrinks'"/>

    
<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>
    
<!-- 输入通道中的OrderItem转成Drink -->
    
<service-activator input-channel="hotDrinks" ref="barista" method="prepareHotDrink" output-channel="preparedDrinks"/>

    
<channel id="preparedDrinks"/>
    
<!-- 通道中的Drink按一个Orderq行合ƈ成一个List<Order>-->
    
<aggregator input-channel="preparedDrinks"  method="prepareDelivery" output-channel="deliveries">
        
<beans:bean class="org.springframework.integration.samples.cafe.xml.Waiter"/>
    
</aggregator>

    
<stream:stdout-channel-adapter id="deliveries"/>

    
<beans:bean id="barista" class="org.springframework.integration.samples.cafe.xml.Barista"/>

    
<poller id="poller" default="true" fixed-delay="1000"/>

</beans:beans>


paulwong 2012-06-11 10:04 发表评论
]]>
վ֩ģ壺 | ¡| | | | ɽ| | ̨| | | ˲| ƽ| ¡| | µ| | | | | ͭ| | | ȷ| żҸ| | | | | Դ| | | | | ٲ| ɽ| | | | | կ| ɽ|