Search code examples
propertieswso2sequenceesbmediator

Wso2 - call sequence with get-property


This is the scenario: - Three sequences: s1, s2, s3 - One variable stored in a registry (localEntry) sets to 1 - Get the seqName with a concat - Try to call the sequence with get-property

What I've done until now:

1) Extract the value

    <property name="getSequence" expression="get-property('registry','conf:repository/myVersion2.xml')" scope="default" type="OM"/>
<log level="custom">
    <property name="TestVersion::localEntry"    expression="$ctx:getSequence//localEntry"/>
</log>

2) Concat

     <property name="seqName"
               expression="concat('s', $ctx:getSequence//localEntry)"
               scope="default"
               type="STRING"/>

3) Call the sequence

           <sequence key="get-property('seqName')"/>

4) Execute the test

5) Get error:

TID: [0] [ESB] [2015-07-08 10:27:36,325]  INFO {org.apache.synapse.mediators.builtin.LogMediator} -  TestVersion::info = setting property {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2015-07-08 10:27:36,327]  INFO {org.apache.synapse.mediators.builtin.LogMediator} -  TestVersion::localEntry = 1 {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2015-07-08 10:27:36,327]  INFO {org.apache.synapse.mediators.builtin.LogMediator} -  TestVersion::Sequence = s1 {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2015-07-08 10:27:36,327]  INFO {org.apache.synapse.mediators.builtin.LogMediator} -  TestVersion::info = filter1 {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2015-07-08 10:27:36,327]  INFO {org.apache.synapse.mediators.builtin.LogMediator} -  TestVersion::info = LOG_S1_TRUE {org.apache.synapse.mediators.builtin.LogMediator}
TID: [0] [ESB] [2015-07-08 10:27:36,329] ERROR {org.apache.synapse.mediators.base.SequenceMediator} -  Sequence named Value {name ='null', keyValue ='get-property('seqName')'} cannot be found {org.apache.synapse.mediators.base.SequenceMediator}

So the problem seems how the information stored in 'seqName' could be read by the sequence as the sequence name and not as a string.

I tried also with

           <sequence key="{get-property('seqName')}"/>

But this doesn't work too...

Thank you in advance.

Claudio


Solution

  • Fixed!

    <sequence xmlns:local="ws.apache.org/ns/synapse" key="{get-property('seqName')}"/>
    

    Thanks to everybody!

    Regards Claudio