Using loop EIP to solve a Usecase

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Using loop EIP to solve a Usecase

gargankur007
Hi
 
I have a usecase in which I have a route which takes m number of rest URLS' as input and then hits each of these URLS's n number of times each until response code comes out to be 204.

So hit a URL until 204 is response code and if it returns 204 move on to next URL and apply same procedure.

I tried to use loop EIP but it did not work.Please suggest.
Reply | Threaded
Open this post in threaded view
|

Re: Using loop EIP to solve a Usecase

Claus Ibsen-2
Hi

The loop is for a fixed number of iterators, its not dynamic.

Instead you can take a look at dynamic router
http://camel.apache.org/dynamic-router.html

On Thu, Jun 4, 2015 at 4:44 PM, gargankur007 <[hidden email]> wrote:

> Hi
>
> I have a usecase in which I have a route which takes m number of rest URLS'
> as input and then hits each of these URLS's n number of times each until
> response code comes out to be 204.
>
> So hit a URL until 204 is response code and if it returns 204 move on to
> next URL and apply same procedure.
>
> I tried to use loop EIP but it did not work.Please suggest.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Using-loop-EIP-to-solve-a-Usecase-tp5767874.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [hidden email]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/
Reply | Threaded
Open this post in threaded view
|

Re: Using loop EIP to solve a Usecase

gargankur007
Can I stop the loop in between based on some condition?

So I fix the number of iterations to high number and then based on some condition terminate the loop early.
Reply | Threaded
Open this post in threaded view
|

AW: Using loop EIP to solve a Usecase

Jan Matèrne (jhm)
Just a thought ...


from("direct:loop")
    .process(
        // set special header if loop should continue
    );
    .switch()
        .when( specialHeaderIsSet ).to("direct:loop")
        .otherwise("direct:nextStep")
;



Jan



> -----Ursprüngliche Nachricht-----
> Von: gargankur007 [mailto:[hidden email]]
> Gesendet: Freitag, 5. Juni 2015 08:56
> An: [hidden email]
> Betreff: Re: Using loop EIP to solve a Usecase
>
> Can I stop the loop in between based on some condition?
>
> So I fix the number of iterations to high number and then based on some
> condition terminate the loop early.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Using-
> loop-EIP-to-solve-a-Usecase-tp5767874p5767894.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: Using loop EIP to solve a Usecase

gargankur007
In reply to this post by Claus Ibsen-2
HI Claus

I have used dynamic router now.

It helped a lot..

Please help me solve "http://camel.465427.n5.nabble.com/Document-Style-bare-WSDL-not-working-in-camel-cxf-td5767867.html" as well
Reply | Threaded
Open this post in threaded view
|

Re: Using loop EIP to solve a Usecase

gargankur007
Hi Claus

If I am using a dynamic router to direct to same component from where message originated it is going into infinite loop
Below is the log
23:29:13,492 | INFO  | E-URL.readQueue] | SLAEventNotifer                  | 142 - org.apache.camel.camel-core - 2.12.0.redhat-610379 | [Message Id:ID:HC14-123-61966-1433526836329-5:8:1:1:1-1] From :activemq://queue:RMHP.OUTBOUND_EDI_FLOW_LOOPER.CHECK.DATA-GET-MULTIPLE-URL.readQueue To: activemq://queue:RMHP.OUTBOUND_EDI_FLOW_LOOPER.CHECK.DATA-GET-MULTIPLE-URL.readQueue
23:29:26,761 | INFO  | E-URL.readQueue] | SLAEventNotifer                  | 142 - org.apache.camel.camel-core - 2.12.0.redhat-610379 | [Message Id:ID:HC14-123-61966-1433526836329-5:8:1:1:1-1] From :activemq://queue:RMHP.OUTBOUND_EDI_FLOW_LOOPER.CHECK.DATA-GET-MULTIPLE-URL.readQueue To: activemq://queue:RMHP.OUTBOUND_EDI_FLOW_LOOPER.CHECK.DATA-GET-MULTIPLE-URL.readQueue

Reply | Threaded
Open this post in threaded view
|

Re: Using loop EIP to solve a Usecase

gargankur007
It worked fine.Thanks Claus..:)