You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "kraythe ." <kr...@gmail.com> on 2013/10/16 23:43:44 UTC

Creating a Component that Calls Another Component

Greetings,

I want to create a component that calls another component in essence.
Specifically I have a remote REST based service that I call. I would like
to wrap those calls in a component to reduce the route verbosity we are
faced with. That means that I will need a component to call that service
and do something like the following.

to("myservice:doStuff?host=www.foo.bar&port=330")

The issue i am faced with is essentially this component needs all of the
functionality of HTTP4 component, just different processing after the call
and before the call. What is the best way to do this? Do I extend the HTTP4
component? Is there a way to call the http4 component from inside my route?
What is the best practice here. Currently there are the same 15 lines of
route code all over the place and I would like to reduce that.

*Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
*Author of: Hardcore Java (2003) and Maintainable Java (2012)*
*LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39*

Re: Creating a Component that Calls Another Component

Posted by Christian Posta <ch...@gmail.com>.
Wonder if there is a better way to share routes that are spread all over
your integration by using direct/seda/vm, etc than to try to merge
components into one.

Maybe you can post a more detailed example with sample routes to illustrate
what you're trying to solve?


On Wed, Oct 16, 2013 at 2:43 PM, kraythe . <kr...@gmail.com> wrote:

> Greetings,
>
> I want to create a component that calls another component in essence.
> Specifically I have a remote REST based service that I call. I would like
> to wrap those calls in a component to reduce the route verbosity we are
> faced with. That means that I will need a component to call that service
> and do something like the following.
>
> to("myservice:doStuff?host=www.foo.bar&port=330")
>
> The issue i am faced with is essentially this component needs all of the
> functionality of HTTP4 component, just different processing after the call
> and before the call. What is the best way to do this? Do I extend the HTTP4
> component? Is there a way to call the http4 component from inside my route?
> What is the best practice here. Currently there are the same 15 lines of
> route code all over the place and I would like to reduce that.
>
> *Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
> *Author of: Hardcore Java (2003) and Maintainable Java (2012)*
> *LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39*
>



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