You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "S. Ali Tokmen" <sa...@bull.net> on 2010/11/25 18:57:29 UTC
Loop in a CAMEL route
Hello
I am currently interacting with a webservice from which I request lists
of documents. The issue is that the web service can only return
documents 100 by 100; therefore I need to loop and I do not know how
much documents I have total. Basically, it looks like:
var List allDocuments
var Pointer lastDocument = beginning
while web service still has documents
var List documents = get documents starting from lastDocument
lastDocument = documents.lastDocument
allDocuments.add documents
I've taken a look at http://camel.apache.org/loop.html but that one
requires me to know the total number of loops; which I do not.
Any solutions?
Cheers
--
S. Ali Tokmen
savas-ali.tokmen@bull.net
Office: +33 4 76 29 76 19
GSM: +33 66 43 00 555
Bull, Architect of an Open World TM
http://www.bull.com
Re: Loop in a CAMEL route
Posted by "S. Ali Tokmen" <sa...@bull.net>.
Hello Claus
I had thought about the dynamic router EIP; but still check since I
thought there was an Expression or something like that in a loop (like
"should I still go ahead?").
Thank you
S. Ali Tokmen
savas-ali.tokmen@bull.net
Office: +33 4 76 29 76 19
GSM: +33 66 43 00 555
Bull, Architect of an Open World TM
http://www.bull.com
On 25/11/2010 18:59, Claus Ibsen wrote:
> The Loop DSL uses a predicate so you can compute this.
>
> You can also use the dynamic router EIP and just circle back to the
> web service until you are done.
>
> Or from a POJO where you can do the loop logic in Java code.
>
>
>
> On Thu, Nov 25, 2010 at 6:57 PM, S. Ali Tokmen
> <sa...@bull.net> wrote:
>> Hello
>>
>> I am currently interacting with a webservice from which I request lists of
>> documents. The issue is that the web service can only return documents 100
>> by 100; therefore I need to loop and I do not know how much documents I have
>> total. Basically, it looks like:
>>
>> var List allDocuments
>> var Pointer lastDocument = beginning
>> while web service still has documents
>> var List documents = get documents starting from lastDocument
>> lastDocument = documents.lastDocument
>> allDocuments.add documents
>>
>>
>> I've taken a look at http://camel.apache.org/loop.html but that one requires
>> me to know the total number of loops; which I do not.
>>
>> Any solutions?
>>
>> Cheers
>>
>> --
>>
>> S. Ali Tokmen
>> savas-ali.tokmen@bull.net
>>
>> Office: +33 4 76 29 76 19
>> GSM: +33 66 43 00 555
>>
>> Bull, Architect of an Open World TM
>> http://www.bull.com
>>
>>
>
>
Re: Loop in a CAMEL route
Posted by Claus Ibsen <cl...@gmail.com>.
The Loop DSL uses a predicate so you can compute this.
You can also use the dynamic router EIP and just circle back to the
web service until you are done.
Or from a POJO where you can do the loop logic in Java code.
On Thu, Nov 25, 2010 at 6:57 PM, S. Ali Tokmen
<sa...@bull.net> wrote:
> Hello
>
> I am currently interacting with a webservice from which I request lists of
> documents. The issue is that the web service can only return documents 100
> by 100; therefore I need to loop and I do not know how much documents I have
> total. Basically, it looks like:
>
> var List allDocuments
> var Pointer lastDocument = beginning
> while web service still has documents
> var List documents = get documents starting from lastDocument
> lastDocument = documents.lastDocument
> allDocuments.add documents
>
>
> I've taken a look at http://camel.apache.org/loop.html but that one requires
> me to know the total number of loops; which I do not.
>
> Any solutions?
>
> Cheers
>
> --
>
> S. Ali Tokmen
> savas-ali.tokmen@bull.net
>
> Office: +33 4 76 29 76 19
> GSM: +33 66 43 00 555
>
> Bull, Architect of an Open World TM
> http://www.bull.com
>
>
--
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/