namalfernandolk
namalfernandolk

Reputation: 9134

Implement Iterate in parrelel execution with aggregate in a single sequence WSO2 ESB5

What I want to do is implement Iterate in parrelel execution with aggregate in a single sequence (without using call/send medior within it).

When I implement the Aggregate in the out sequence this works fine as mentioned below.

<inSequence>
    <property name="it_count" scope="operation" type="STRING" value="0"/>
    <iterate expression="//symbols/symbol">
        <target>
            <sequence>
                <log level="custom">
                    <property name="ITERATING..."  expression="$body"/>
                </log>
               <enrich>
                    <source type="inline">
                        <out xmlns="">TEST</out>
                    </source>
                    <target xpath="//symbol"/>
                </enrich>
                 <log level="custom">
                    <property name="ITERATING..."  expression="$body"/>
                </log>
                <loopback/>
            </sequence>
        </target>
    </iterate>
</inSequence>

<outSequence>
    <property name="response" scope="default">
        <response xmlns=""/>
    </property>
    <aggregate>
        <completeCondition>
            <messageCount max="-1" min="-1"/>
        </completeCondition>
        <onComplete enclosingElementProperty="response" expression="//out">
            <log level="custom">
                <property name="AGGREGATING..." expression="$body"/>
            </log>
        </onComplete>
    </aggregate>
    <send/>
</outSequence>

But I'm facing a difficulty of doing it in the same seqence as like below. It doesn't come even to the Aggegate log. I tried various ways but still faced.

<inSequence>
    <property name="it_count" scope="operation" type="STRING" value="0"/>
    <iterate expression="//symbols/symbol">
        <target>
            <sequence>
                <log level="custom">
                    <property name="ITERATING..."  expression="$body"/>
                </log>
               <enrich>
                    <source type="inline">
                        <out xmlns="">TEST</out>
                    </source>
                    <target xpath="//symbol"/>
                </enrich>
                 <log level="custom">
                    <property name="ITERATING..."  expression="$body"/>
                </log>
                <loopback/>
            </sequence>
        </target>
    </iterate>
    <property name="response" scope="default">
        <response xmlns=""/>
    </property>
    <aggregate>
        <completeCondition>
            <messageCount max="-1" min="-1"/>
        </completeCondition>
        <onComplete enclosingElementProperty="response" expression="//symbol">
            <log level="custom">
                <property name="AGGREGATING..." expression="$body"/>
            </log>
        </onComplete>
    </aggregate>
    <respond/>
</inSequence>
<outSequence/>

I know if I use Call/Send mediator within the Iterate I can do this in one sequence. But in my case I don't use one in there. Can anyone give a clue for this.

Upvotes: 0

Views: 652

Answers (1)

Jean-Michel
Jean-Michel

Reputation: 5946

In the 2nd case, add attribute continueParent="true" on iterate mediator (you don't want this mediation to stop after iterate mediator) and remove loopback mediator (you don't want to send anything to an out sequence)

Upvotes: 1

Related Questions