Mule ESB 学习笔记(3)

根据实际需求着重检查了一下Mule ESB的消息传递方式。Mule支持经常使用的几种消息传递方式,可以知足要求。异步

 

5. 消息传递方式spa

5.1 异步方式code

异步方式是一种单向调用,调用者不须要得到响应。component

图 Asynchronousrouter

异步方式经过inboundoutbound endpointexchange-pattern=”one-way”实现。字符串

使用基本的Stdio Transport验证,经过标准输入传输字符串,将其原样传递给标准输出进行显示。相应配置以下:it

<service name="echo">
    <inbound>
        <stdio:inbound-endpoint system="IN" exchange-pattern="one-way" />
    </inbound>
    
    <component>
        <singleton-object class="demo.mule.umo.StdIo" />
    </component>
    
    <outbound>
        <pass-through-router>
            <stdio:outbound-endpoint system="OUT" exchange-pattern="one-way" />
        </pass-through-router>
    </outbound>
</service>

运行服务,控制台显示结果以下:io

Please enter: Hello, world!
INFO  2010-12-07 19:21:18,877 [ConsoleConnector.dispatcher.1]
    org.mule.lifecycle.AbstractLifecycleManager: Initialising:
    'ConsoleConnector.dispatcher.23255376'. Object is: StdioMessageDispatcher
INFO  2010-12-07 19:21:18,877 [ConsoleConnector.dispatcher.1]
    org.mule.lifecycle.AbstractLifecycleManager: Starting:
    'ConsoleConnector.dispatcher.23255376'. Object is: StdioMessageDispatcher
Hello, world!

其中INFO输出是Mule第一次初始化相应Connector打印出来的,以后调用服务不会再次显示。class

异步方式适用于简单的消息传递的场景。配置

 

to be continued...

相关文章
相关标签/搜索