synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Udayanga Wickramasinghe <>
Subject Function-Templates for Synapse Configuration
Date Tue, 08 Mar 2011 15:07:13 GMT
Hi Devs,
We thought of implementing $subject for Synapse. At the moment a large
portion of ESB configuration are at the micro level. Because of this Users
have to individually configure each and every mediator to achieve some high
level task. But what we need is a high level abstraction that users can
easily use to model such scenarios .
For example if we consider following scenario ,

 <proxy name="SplitAggregateProxy">
               <iterate expression="//m0:getQuote/m0:

                   <onComplete expression="//m0:getQuoteResponse"

Here what user really wants  to look at is three configuration parameters ,

1. Two XPath expressions
2. An endpoint address

We believe we can hide a lot of this complexity by introducing a 'template'
configuration that parameterize(like a function does) a known pattern such
as this one.Parameterization can be done using xpath expressions..

implementation of function templates will look like following in synapse
1) we have Function Template in the form ;

<template name="[func name]">
               <parameter name="p1" />*
     <any sequence>+

-->A Template is an extension of Sequence , hence template body can contain
any sequence in general
--> any mediator/comp inside template body can refer to its parameters just
like a normal function does ,by xpath function scope (ie:-func) variable
        ie:- <aggregate>
                    <onComplete xmlns:m0="http://services.samples"

                        <log level="full" />
           <log level="custom">
                 <property name="p1-value" expression="$func:p1"/>
                <property name="p2-value"

--> we have to define template at top level so that it is a reusable
function that can be referred by others
-->A func template can execute other functions or execute recursively (using
Invoke mediator)

2)To invoke a template in synapse we have to use a Invoke mediator which
will be defined in the following  form. Using a invoke mediator ,from
within any sequence we would be able to invoke a template with the passed on
values for parameters such as p1,p2,etc....  :
        <invoke target="[target func template]">
            <parameter name="p2"  value="{any xpath} | plain-value"/>*

IMO this will greatly reduce complexity of the configurations and would be
able to eliminate redundancy...WDYT?.. really appreciate feedback regarding

*Udayanga Wickramasinghe*
Software Engineer; WSO2 Inc.;,
*email: *** <>* cell: +94 (77) 983-4365
blog: ***<>
twitter: ***<>

View raw message