You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by samslara <sa...@yahoo.com> on 2013/05/20 16:19:18 UTC

calling a non-"direct" consumer "directly"

Hello,
  I have a question.  Suppose I have a route that has a consumer that is not
"direct", say it's jetty.  For example:

<route R1>
  <from uri="jetty:http://localhost:8080/test" />
  <to ... />
  <to ... />
</route>

now I want to invoke this route from another route but I don't want to go
via http, rather I want to treat it as if it's direct consumer.  I'm doing
this from either a regular producer/processor or programmatically (maybe a
producerTemplate which I guess is still a producer), so I have an exchange
that I want to just pass to the consumer as if the consumer is using the
direct component.  Is this possible and if so how?

note: I don't want to actually modify route R1 to have a direct consumer, I
want to keep it the same but just invoke it directly without having to go
through the transport protocol and such of the consumer, in this case being
jetty:http.  Also it's all from within the same camel context as the route
R1.



--
View this message in context: http://camel.465427.n5.nabble.com/calling-a-non-direct-consumer-directly-tp5732844.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: calling a non-"direct" consumer "directly"

Posted by Christian Posta <ch...@gmail.com>.
Don't think you can do specifically what you're asking.. i would do this...

from("jetty:http://host:port....").to("direct:intermediate")

from("direct:intermediate").to(.....rest of your route.....)

That way you can break up your route into stages and have different
endpoints (jetty, direct, jms, etc) have access to the core routing logic.
This is kind of camel's bread and butter to have switchable endpoints and
even have multiple endpoints feeding the same logic.




On Mon, May 20, 2013 at 7:19 AM, samslara <sa...@yahoo.com> wrote:

> Hello,
>   I have a question.  Suppose I have a route that has a consumer that is
> not
> "direct", say it's jetty.  For example:
>
> <route R1>
>   <from uri="jetty:http://localhost:8080/test" />
>   <to ... />
>   <to ... />
> </route>
>
> now I want to invoke this route from another route but I don't want to go
> via http, rather I want to treat it as if it's direct consumer.  I'm doing
> this from either a regular producer/processor or programmatically (maybe a
> producerTemplate which I guess is still a producer), so I have an exchange
> that I want to just pass to the consumer as if the consumer is using the
> direct component.  Is this possible and if so how?
>
> note: I don't want to actually modify route R1 to have a direct consumer, I
> want to keep it the same but just invoke it directly without having to go
> through the transport protocol and such of the consumer, in this case being
> jetty:http.  Also it's all from within the same camel context as the route
> R1.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/calling-a-non-direct-consumer-directly-tp5732844.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta