WSO2 學習筆記(三)

關於 Conditional Router Mediator

1. WSO2官方文檔中的沒有對condition中的match, equal, type等做說明,只是從其唯一的Sample中可以看出condition是支持與或非等邏輯的。但sample中的type僅僅用到了header, url, param這三個。那麼能不能用property呢?我發現是可以的,比如可以像下面這樣定義

<condition>
    <and>
        <equal  type="property" source="property1" value="value1"/>
        <equal  type="property" source="property2" value="value2"/>
    </and>
</condition>

2. 使用Conditional Router Mediator時,分支必須是sequence,這時如果sequence裏是send到一個endpoint,而且我們希望獲得sequence裏endpoint的返回信息,就不行了,會報如下錯誤。而用Switch就沒有這個問題。所以Conditional Router Mediator適合不需要獲得下游系統返回信息的情況,比如做異步接口將message放入MQ中,而如果是同步接口且希望獲得反饋,則應該使用Switch.

WARN - PassThroughHttpSender Trying to submit a response to an already closed connection : http-incoming-6

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章