ClaudioM
ClaudioM

Reputation: 1446

wso2 - using value from a property to retrive sequence name

I'm configuring a proxy-service and I have three sequences: s1,s2,s3

The value of 1,2,3 is stored in a local registry variable and it's get from the registry and stored in the property called 'myProp'

now, based on the value of this myProp I would like to call one of the three sequences.

I tried this:

               <sequence key="s{concat(get-property('myProp'))}"/>

but doesn't works.

This is the property code:

         <property name="myProp"
               expression="get-property('registry','conf:repository/myVersion2.xml')"
               scope="default"
               type="STRING"/>

and this is what I'm trying to do:

         <filter source="get-property('myProp')"
             regex=".*&gt;1&lt;.*"
             description="filter">
        <then>
           <log level="custom" separator=":">
              <property name="TestVersion" value="LOG_S1_TRUE"/>
              <property name="TestVersion" expression="get-property('myProp')"/>
           </log>
           <sequence key="s{concat(get-property('myProp'))}"/>
        </then>
        <else>
           <log level="custom" separator=":">
              <property name="TestVersion" value="LOG_S1_FALSE"/>
           </log>
        </else>
     </filter>

I get this error from the log:

TID: [0] [ESB] [2015-07-03 12:47:25,340] ERROR {org.apache.synapse.mediators.base.SequenceMediator} -  Sequence named Value {name ='null', keyValue ='s{concat(get-property('myProp'))}'} cannot be found {org.apache.synapse.mediators.base.SequenceMediator}

Thanks in advance to who know how to solve it.

Regards Claudio

Upvotes: 0

Views: 1529

Answers (1)

Jan
Jan

Reputation: 653

Assign the keyvalue to a property first to test it, you will notice that it cannot work :) Try: <sequence key="{concat('s', get-property('myProp'))}"/>

Upvotes: 3

Related Questions