Yasothar
Yasothar

Reputation: 453

wso2 ESB iterate mediator to handle nullity

I call a wso2 DSS data service, which will return available database rows as response. I use an Iterate mediator to iterate over the elements and perform the required task.

My issue is when the database has no entries, the data service doesn't return a response but the iterate mediator starts to iterate and throws up an exception in the ESB. Is there a property to tell the iterate mediator only to iterate if elements are available? Similar to a java if (null) check

Upvotes: 1

Views: 368

Answers (1)

Jean-Michel
Jean-Michel

Reputation: 5946

Check if there is data before calling iterate mediator :

<filter xpath="boolean($body/something)">
    <then>
        --> iterate
    </then>
</filter>

xpath expression return true if "something" node exist

Upvotes: 1

Related Questions