appache synapse使用

1.简介
 synapse是一个对消息进行处理的中间件。
1.1 synapse的目录结构
-bin
 synapse.bat /*启动synapse的批处理文件*/
-docs
-lib
-logs
-repository
 -conf /*配置文件*/
  -sample
-resources
-samples
-work
1.2 synapse的启动
 synapse.bat -sample 0;
 意思:启动synapse,启动的配置文件为bin/repository/conf/sample/synapse_sample_0.xml

 2.消息的调制(Message Mediation)
service Mediation

3.proxy service 代理服务
代理服务能够拦截客户端的请求和服务端的响应。

我们通过代理服务能够拦截客户端的请求,能够对请求做我们想要的处理。
比如:把请求发给另外一个服务或另外几个服务或不发送给任何的服务。

例如,在启动synapse时可以设置启动的xml的配置如下:

<definitions xmlns="http://synapse.apache.org/ns/2010/04/configuraiton">
<proxy name="StockQuoteProxy">
 <target>
   <endpoint>
    <address uri="http://localhost:9000/services/SimpleStockQuoteService"/> </endpoint>
  <outSequence>
    <send/>
  </outSequence>
</target>
 <publishWSDL uri="file:repository/con1f/sample/resources/proxy/sample_proxy_1.wsdl"/>
</proxy>
</definitions>

配置的说明:
definitions节点:definitions是XML配置的根节点
proxy节点:表示定义了一个代理服务。
 target节点:表示这个代理服务要把请求发送给哪个服务端。
 endpoint节点:代表了终端。
 outSequence节点:表示终端的输出序列方法
publishWSDL节点:要发布的WSDL信息。

我们通过设置代理的proxy使当前的

There is also an out sequence for the proxy service, which will be executed for response messages.
In the out sequence, we just send the messages back to the client
我们为代理服务设置了一个out sequence,在响应消息时outSequence会被执行,这里我们仅仅只是把消息传回给了客户端。

这里涉及到了ant,关于ant的使用可以在网上进行参考。

消息调解和代理服务。

posted on 2015-11-19 08:05  KEJ  阅读(246)  评论(0编辑  收藏  举报

导航