You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Max Bridgewater <ma...@gmail.com> on 2014/03/31 17:16:53 UTC

What are your Camel Best Practices?

Hey Guys,

I am just wondering what your best practices are. Despite the marvelous job
in "Apache Camel Developer's
Cookbook<http://www.amazon.com/dp/1782170308/ref=rdr_ext_tmb>",
and in http://camel.apache.org/cookbook.html, there are still things that
one comes up with that simplify one's life with Camel.

Here are two of mine:

1) This one is implicit when you look at Camel source: always prefix your
camel component header's name with Camel+ComponentName. For instance,
CamelAzurePreset. This has helped me during troubleshooting and when one
needs to clear the headers for a given component. One can use a matching
pattern to identify all headers pertaining to a component.

2) When creating a component, do not pass stuff through the body of the
message. Preferably, use only headers/properties. When using the body,
people have to do a lot of extra work to call your component: backup their
body, put the parameter you need in the header, call your component,
restore the original body.

Do these make sense to you? What other best practices do simplify your
daily Camel ride?

Thanks for sharing.

Max.

Re: What are your Camel Best Practices?

Posted by Bilgin Ibryam <bi...@gmail.com>.
Hi Max,

there is no central place with Camel best practices as most of these are
unwritten code conventions, common sense, or practices followed for the
sake of consistency.

The first one you have identified is correct. Prefixing header names with
component name will prevent headers from being used by other components.

The second is more arguable, as most components expect their main input as
message body even though it may require more work from the developer.

Most of these are non written practices and not written rules as they
should be applied with consideration rather than followed as a rule.

HTH,


On 31 March 2014 16:16, Max Bridgewater <ma...@gmail.com> wrote:

> Hey Guys,
>
> I am just wondering what your best practices are. Despite the marvelous job
> in "Apache Camel Developer's
> Cookbook<http://www.amazon.com/dp/1782170308/ref=rdr_ext_tmb>",
> and in http://camel.apache.org/cookbook.html, there are still things that
> one comes up with that simplify one's life with Camel.
>
> Here are two of mine:
>
> 1) This one is implicit when you look at Camel source: always prefix your
> camel component header's name with Camel+ComponentName. For instance,
> CamelAzurePreset. This has helped me during troubleshooting and when one
> needs to clear the headers for a given component. One can use a matching
> pattern to identify all headers pertaining to a component.
>
> 2) When creating a component, do not pass stuff through the body of the
> message. Preferably, use only headers/properties. When using the body,
> people have to do a lot of extra work to call your component: backup their
> body, put the parameter you need in the header, call your component,
> restore the original body.
>
> Do these make sense to you? What other best practices do simplify your
> daily Camel ride?
>
> Thanks for sharing.
>
> Max.
>



-- 
Bilgin Ibryam

Apache Camel & Apache OFBiz committer
Blog: ofbizian.com
Twitter: @bibryam <https://twitter.com/bibryam>

Author of Instant Apache Camel Message Routing
http://www.amazon.com/dp/1783283475