Hi John,
You can use a property to count the number of iterations and invoke the
next service once all iterations are finished.
For example,
<property name="activitiesCount" expression="count(//result)"
scope="operation"/>
<property name="activitiesIndex" value="0" scope="operation"/>
<iterate expression="//result">
<target>
<sequence>
------
<property name="activitiesIndex"
expression="get-property('operation','activitiesIndex') + 1"
scope="operation"/>
</sequence>
</target>
</iterate>
<filter xpath="get-property('operation',
'activitiesIndex')=get-property('operation','activitiesCount')">
<then>
-----call service---
</then>
</filter>
Thanks,
On Wed, Sep 16, 2015 at 10:45 PM, John Q <[email protected]> wrote:
> Colin, thanks for your answer, actually I am using the iterate mediator,
> the problem is that I want to receive the original message, iterate over
> all the items calling the service for each one and finally call another
> service onlye once, but the service is invoked many times.
>
> this is what I have now:
>
> <iterate>
> <target>
> here I call the service for the item...
> </target>
> </iterate>
> here I call the service to notify
>
> the notify service is been invoked per each item...
>
> On Wed, Sep 16, 2015 at 1:11 PM, Colin Roy-Ehri <[email protected]> wrote:
>
>> Hi John Q,
>>
>> The aggregate mediator is used for exactly this purpose (1).
>>
>> (1) https://docs.wso2.com/display/ESB481/Aggregate+Mediator
>>
>> Thanks,
>> Colin Roy-Ehri
>> Software Engineer
>> *WSO2, Inc. : wso2.com <http://wso2.com/>*
>> *Mobile* : 812-219-6517
>>
>> On Wed, Sep 16, 2015 at 12:56 PM, John Q <[email protected]> wrote:
>>
>>> Hello, I´m beginner and I need some help with the ESB.
>>>
>>> This is my situation:
>>>
>>> I will receive a message with many items, I need to iterate the items
>>> list and call a service for creating each item. At the end of all of the
>>> calls, I need to call another service to notify the end of items creation.
>>>
>>> how can I do it? I have used the iterate mediator and I have iterated
>>> the items well, but I don´t know how to wait until the last item is created
>>> and call the notify service only once. I have called the notify service
>>> outside the iterator mediator, but it is invoked once per each item
>>> iterated.
>>>
>>> can any body give me a clue?
>>>
>>> best regards...
>>>
>>> _______________________________________________
>>> Architecture mailing list
>>> [email protected]
>>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>>>
>>>
>>
>
> _______________________________________________
> Architecture mailing list
> [email protected]
> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>
>
--
<[email protected]>
Keerthika Mahendralingam
Associate Software Engineer
Mobile :+94 (0) 776 121144
[email protected]
WSO2, Inc.
lean . enterprise . middleware
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture