標籤:
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的使用可以在網上進行參考。
訊息調解和代理服務。
appache synapse使用