On Fri, Sep 30, 2011 at 3:03 PM, Kasun Indrasiri <[email protected]> wrote:
> Hi all,
>
> In the current ESB implementation we have couple of mediators for message
> routing. While 'Filter' and 'Switch' mediators provide basic level of
> message filtering, router mediator is also doing very similar to what
> filter/switch mediators do. The usage of Router mediator is rare and often
> got replaced by filter/switch mediators. So, IMO, Router Mediator is
> redundant, unless it provides some advance/complex routing logic support.
>
> In the ESB 4.0.0 release, we introduces 'Conditional Router', which is
> intended to route messages based on HTTP headers, query parameters and url.
> However, this doesn't support routing based on message payload. But unlike
> 'Router', the 'Conditional Router' introduces uses the concepts of
> 'Evaluators' (And, Or, Match, Equal, Not) that can be utilize to construct
> complex routing logics.
>
> eg:
> <conditionalRouter continueAfter="false">
> <conditionalRoute breakRoute="false">
> <condition>
> <and xmlns="">
> <match type="header"
> source="my_custom_header1" regex="foo.*"/>
> <match type="url"
> regex="/services/StockQuoteProxy.*"/>
> </and>
> </condition>
> <target sequence="cnd2_seq"/>
> </conditionalRoute>
>
> <conditionalRoute breakRoute="false">
> <condition>
> <and xmlns="">
> <match type="header"
> source="my_custom_header2" regex="bar.*"/>
> <equal type="param" source="qparam1"
> value="qpv_foo"/>
> <or>
> <match type="url"
> regex="/services/StockQuoteProxy.*"/>
> <match type="header"
> source="my_custom_header3" regex="foo.*"/>
> </or>
> <not>
> <equal type="param" source="qparam2"
> value="qpv_bar"/>
> </not>
> </and>
> </condition>
> <target sequence="cnd3_seq"/>
> </conditionalRoute>
> </conditionalRouter>
>
> So, we can easily add message level routing capability(so that we can drop
> Router mediator) to Conditional Router and with that we'll get the power of
> using evaluators for message level routing as well. Having bunch of
> mediators that's doing the similar thing, cause a negative effect on ESB's
> usability.
>
> (Most of the pointed listed here, were discussed during last code-review of
> Group-D.)
>
Another thing we saw was in consistency of naming. Lets take the following
two mediators
<router>
<route expression="//ns1:foo/ns1:bar" match="test">
<target />
</route>
</router>
<filter source="//ns1:foo/ns1:bar" regex="test">
<then />
<else />
</filter>
Both say the same thing but different attribute names are used at different
mediators. This can be seen in other places as well. Therefore I think it is
better to follow one set of naming convention in each mediators.
thanks,
Amila.
>
>
> *
> *
> [1] http://wso2.org/project/esb/java/4.0.0/docs/mediator_guide.html
>
>
> Thanks,
> --
> Kasun Indrasiri
> Associate Technical Lead
> WSO2, Inc.; http://wso2.com
> lean.enterprise.middleware
>
> cell: +94 71 536 4128
> Blog : http://kasunpanorama.blogspot.com/
>
_______________________________________________
Carbon-dev mailing list
[email protected]
http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev