The only problem is that the individual rules don't signal whether they matched. The true/false is not an indication.
So I was imagining this:
<switch type="regex">
<pattern pattern=" http://foo/.*">
<mediator1>
</pattern>
<pattern pattern="http://bar/.*">
<mediator2>
</pattern>
</switch>
Paul
Title: Proposal for <switch/> mediator
Let's start with the syntax
<switch >
<xpath/>*
<regex/>*
</switch>
Note: "*" means 0 or N number of mediators.
Description:
All the mediators available in Synapse, <regex/> and <xpath/> can be considered as the conditional mediators and all other mediators are static and guarantee of doing some mediation work in line.
Say a scenario as follows,
<switch>
<xpaht dosomething1/>
<regex dosomething2/>
<regext dosomething3/>
<xpath dosomething4/>
</switch>
So if <regex dosomething2/> is passed, all the other mediators thereafter will be ignored. So "exactly one" mediator <regex/> or <xpath/> will be invoked.
The possible disadvantage is, there is no default mediator to execute, if all the mediators in the list failed. Since all <switch/> can include <xpaths/>'s and <regex/>'s.
I feel this is as a "extension" to Synapse rather being core feature.
Please comment.
Thank you
Saminda
--
Paul Fremantle
VP/Technology, WSO2 and OASIS WS-RX TC Co-chair
http://bloglines.com/blog/paulfremantle
[EMAIL PROTECTED]
"Oxygenating the Web Service Platform", www.wso2.com
