Fateme Shahrabi
Fateme Shahrabi

Reputation: 103

can not exit from iterate in wso2 esb

I am new to wso2 esb and now I have trouble with iterate mediator. I used iterate in my code and send desired value to an endpoint but Unfortunately I can not exit from iterator. here is my code

<iterate preservePayload="true"
              attachPath="//csv-set"
              expression="//csv-set/searchGuestIdentity"
              sequential="true">
        <target>
           <sequence>
              <xslt key="gov:/xmltocsv.xsl"/>
              <xslt key="gov:/new8.xsl"/>
              <xslt key="gov:/RemoveXMLdeclaration.xsl"/>
              <send>
                 <endpoint>
                    <http format="soap11"
                          method="GET"
                          uri-template="http://myendpoint/services/GuestIdentityService"/>
                 </endpoint>
              </send>
              <log level="full"/>
           </sequence>
        </target>
     </iterate>
     <log>
        <property name="log" value="end of iterate"/>
     </log>

I can not see the log after iterate. can any one help me and say why I can not exit from iterator? also when I send value to endpoint, how can I see the result?

Upvotes: 0

Views: 1717

Answers (3)

Jaggernaught
Jaggernaught

Reputation: 35

I realize the question was asked a long time ago, but maybe someone might need an answer.

Try to use parameter "continueParent" set to "true" in Iterate mediator:

<iterate preservePayload="true"
              continueParent="true"
              attachPath="//csv-set"
              expression="//csv-set/searchGuestIdentity"
              sequential="true">

According to wso2 documentation this parameter is used to specify whether the original message should be preserved or not. Possible values are as follows.

  • True - If this is selected, the original message will be preserved.
  • False - If this is selected, the original message will be discarded. This is the default value.

Upvotes: 2

Mehrnoosh
Mehrnoosh

Reputation: 72

Using Call mediator instead of send mediator and set yes for call mediator. Then you can use response mediator in end of your sequence to see the value of property in the log mediator

Upvotes: 0

Jenananthan
Jenananthan

Reputation: 1401

When you use send mediator inside the iterator, response will come to out sequence. There you can use aggregate mediator[1] to aggregate the responses. You can find an example here[2]. Instead of send mediator ,if you use call mediator[3][4] responses will come to in sequence it self and rest of the logic will get executed.

[1] https://docs.wso2.com/display/ESB500/Aggregate+Mediator

[2] http://shriwithjava.blogspot.com/2015/11/how-to-use-iterator-mediator-in-wso2-esb.html

[3] https://docs.wso2.com/display/ESB500/Call+Mediator

[4] https://medium.com/@pubududp/wso2-esb-how-to-use-call-mediator-457f2b387b94#.iu53akgyr

Upvotes: 0

Related Questions