You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by xverges <xv...@gmail.com> on 2011/12/13 22:03:04 UTC

Dynamic routing and bridgeEndpoint

Hello all.

I've tried to create an http proxy/router using dynamic routing. The
simplest attempt was

  from("jetty:http://0.0.0.0:8080/dynamic/?matchOnUriPrefix=true")
 
.dynamicRouter(constant("http://www.google.com/?q=camel&bridgeEndpoint=true&throwExceptionOnFailure=false"));

It doesn't work, but I'm not even sure if it should. 

The thing is that it gets into an endless loop of

  HttpProducer         DEBUG Executing http GET method:
http://www.google.com/?q=camel
  HttpProducer         DEBUG Http responseCode: 200
  HttpProducer         DEBUG Executing http GET method:
http://www.google.com/?q=camel
  HttpProducer         DEBUG Http responseCode: 200
  HttpProducer         DEBUG Executing http GET method:
http://www.google.com/?q=camel
  HttpProducer         DEBUG Http responseCode: 200

Did I hit a bug or am I attempting something that doesn't make any sense?

Thanks for your time.
-Xavier

--
View this message in context: http://camel.465427.n5.nabble.com/Dynamic-routing-and-bridgeEndpoint-tp5072766p5072766.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Dynamic routing and bridgeEndpoint

Posted by xverges <xv...@gmail.com>.
Thanks! recipientList was what I was looking for, but since my list had only
one member I didn't bother to check...

My apologies: the obvious control loop in the dynamic router diagram wasn't
enough to make me read the red box warning about an endless loop, or the
comments in the sample beans that I copied to check if it was for me
(@return endpoint uri where to go, or <tt>null</tt> to indicate no more).

Sorry for the noise and thanks for your time.
-Xavier



--
View this message in context: http://camel.465427.n5.nabble.com/Dynamic-routing-and-bridgeEndpoint-tp5072766p5073535.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Dynamic routing and bridgeEndpoint

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Why are you using the dynamic router EIP? Just use

from
to

Or

from
recipientList


Read the documentation about the Dynamic Router EIP, as what you do
end up in a endless loop, as the dynamic router will re-evaluate the
expression until it returns null.




On Tue, Dec 13, 2011 at 10:03 PM, xverges <xv...@gmail.com> wrote:
> Hello all.
>
> I've tried to create an http proxy/router using dynamic routing. The
> simplest attempt was
>
>  from("jetty:http://0.0.0.0:8080/dynamic/?matchOnUriPrefix=true")
>
> .dynamicRouter(constant("http://www.google.com/?q=camel&bridgeEndpoint=true&throwExceptionOnFailure=false"));
>
> It doesn't work, but I'm not even sure if it should.
>
> The thing is that it gets into an endless loop of
>
>  HttpProducer         DEBUG Executing http GET method:
> http://www.google.com/?q=camel
>  HttpProducer         DEBUG Http responseCode: 200
>  HttpProducer         DEBUG Executing http GET method:
> http://www.google.com/?q=camel
>  HttpProducer         DEBUG Http responseCode: 200
>  HttpProducer         DEBUG Executing http GET method:
> http://www.google.com/?q=camel
>  HttpProducer         DEBUG Http responseCode: 200
>
> Did I hit a bug or am I attempting something that doesn't make any sense?
>
> Thanks for your time.
> -Xavier
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Dynamic-routing-and-bridgeEndpoint-tp5072766p5072766.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Dynamic routing and bridgeEndpoint

Posted by xverges <xv...@gmail.com>.
> I'd suspect that the default google.com page has some
> relative resources that it's trying to load

I've just tried with 

  from("jetty:http://0.0.0.0:8080/dynamic/?matchOnUriPrefix=true")
 
.dynamicRouter(constant("http://0.0.0.0:8000/?bridgeEndpoint=true&throwExceptionOnFailure=false"));

where localhost:8000 is being served by a dumb server that doesn't ask for
any relative resources ("python -m SimpleHTTPServer") and got the same
result.

-Xavier

--
View this message in context: http://camel.465427.n5.nabble.com/Dynamic-routing-and-bridgeEndpoint-tp5072766p5073004.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Dynamic routing and bridgeEndpoint

Posted by Craig Taylor <ct...@ctalkobt.net>.
At first glance, I'd suspect that the default google.com page has some
relative resources that it's trying to load and is re-obtaining the page,
the browser finds relative resources on the page to load (css, javascript,
images etc) and re-rendering them...

Try a wget / curl on it and see the order of the fetches (place a limit
obviously).


On Tue, Dec 13, 2011 at 4:03 PM, xverges <xv...@gmail.com> wrote:

> Hello all.
>
> I've tried to create an http proxy/router using dynamic routing. The
> simplest attempt was
>
>  from("jetty:http://0.0.0.0:8080/dynamic/?matchOnUriPrefix=true")
>
> .dynamicRouter(constant("
> http://www.google.com/?q=camel&bridgeEndpoint=true&throwExceptionOnFailure=false
> "));
>
> It doesn't work, but I'm not even sure if it should.
>
> The thing is that it gets into an endless loop of
>
>  HttpProducer         DEBUG Executing http GET method:
> http://www.google.com/?q=camel
>  HttpProducer         DEBUG Http responseCode: 200
>  HttpProducer         DEBUG Executing http GET method:
> http://www.google.com/?q=camel
>  HttpProducer         DEBUG Http responseCode: 200
>  HttpProducer         DEBUG Executing http GET method:
> http://www.google.com/?q=camel
>  HttpProducer         DEBUG Http responseCode: 200
>
> Did I hit a bug or am I attempting something that doesn't make any sense?
>
> Thanks for your time.
> -Xavier
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Dynamic-routing-and-bridgeEndpoint-tp5072766p5072766.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
-------------------------------------------
Craig Taylor
ctalkobt@ctalkobt.net