Reputation: 43
I have little problem getting the Iterate mediator to work and have it callout to another external endpoint. However it seems to me (by logging) that the ESB will send out the all the requests fairly fast regardless of whether I set the Sequencing to True or False. This quick request sending seems to be causing me problems with the external web service my endpoint is point at. If I have 1 item in xml for the Iterate to work, everything is fine. But I get all kinds of errors if I Iterate 2 or more.
That is why I am wondering is there anyway I can make the Iterate mediator to call this external endpoint, wait for the response, then call the external endpoint with the next request. How can I achieve that with WSO2 ESB?
If I have to do that with codes, I would have put the requests in an array and set a counter with the size of the array. Then I will grab the first item from the array and call the web service. When the response comes back, I'll put that in the result array first. Increase the counter by 1. Then I check whether there is more items in the request array, if so then I make the next call.
Upvotes: 2
Views: 2006
Reputation: 72
I think you can use "call out" mediator or use "Call" mediator for setting blocking mode to true. For more information please see the following link: https://docs.wso2.com/display/ESB490/Call+Mediator
Upvotes: 0
Reputation: 71
Try using the attribute blocking="true" in the call mediator as shown below,
<call blocking="true">
<endpoint key="yourEndpointName"/>
</call>
This should solve the issue.
Thank you, hope this helps
Upvotes: 0
Reputation: 2625
I think you can use a Flag variable (a property mediator):
I would add a property mediator in the Insquence called STATUS set to "request_iterate", later in the OutSequence you could create a Switch Mediator where the first case match "request_iterate" and a Send mediator which call the endpoint, after it set the property('STATUS') to "response_iterate". The case 2 will match "response_iterate" and perform whatever you have to perform after the response.
If you have problems of timing, you can implement a Throttling scenario using the Message Store and Message Processor.
Note: message patterns are usually meant for asynchronous operations
Hope this help
Upvotes: 0