5.3 同步方式
同步方式即请求方调用服务后,component将处理结果发送给另一个外部服务处理,并将处理结果反方向返回。
图 Synchronous
同步方式通过inbound和outbound endpoint的exchange-pattern=”request-response”实现,相应配置如下:
<flow name="echo"> <inbound-endpoint address="http://localhost:7007/services/Echo" exchange-pattern="request-response" /> <cxf:jaxws-service serviceClass="demo.mule.umo.Echo" /> <component> <singleton-object class="demo.mule.umo.StdIo" /> </component> <vm:outbound-endpoint path="vm" exchange-pattern="request-response" /> </flow> <flow name="vm"> <vm:inbound-endpoint path="vm" exchange-pattern="request-response" /> <component> <singleton-object class="demo.mule.umo.Vm" /> </component> <stdio:outbound-endpoint system="OUT" exchange-pattern="one-way" /> </flow>
同步方式适用于通过Mule调用远程服务的场景。