header naming conventions to avoid issues with some transports such as JMS
Many JMS providers restrict headers to be valid java identifiers. So
headers on messages should not use "." as a separator. It'd also be
nice if they were suitable for use in XML element/attribute names too.
This recently camel up in
So I'm thinking we should review the Camel header naming conventions
we use. Maybe we should switch from the org.apache.camel.foo.bar
notation to be more like CamelFooBar notation instead?
One big benefit of using valid identifiers for header names is we can
use them in JMS selectors - and in bean property notation in
expression languages like EL, OGNL, Groovy, Ruby etc
I've never been a fan of _ in names; it seems much cleaner and elegant
to use CamelCase. Plus given this is Camel we're talking about - its
our destiny to adopt CamelCase :)
So how would folks feel about renaming headers such as
"org.apache.camel.file.name" to CamelFileName?
This would make it a bit easier to reference in expression languages
too. e.g. in Groovy this would look like
in.header.CamelFileName or in.header["CamelFileName"]
e.g. in JMS the JMS headers are just prefixed with "JMS" so am
thinking we can get away with prefixing our headers with "Camel". And
we've always a DSL to transform things if we hit our heads on
While we're talking about headers; I wonder if we can come up with a
convention for defining them in the code. For now we've been adding
them as static constants on the FooComponent class; this seems a
reasonable approach. Maybe we should start annotating them too - then
one day we can write a nice tool to automatically slurp up all of the
known Camel headers and create a nice little online reference?