>
> What we have stored in Headers today in Camel is both:
> - user headers
> - and system headers (added by Camel itself).
>
> I am starting to be more and more convinced that we should separate the two.
> So any headers that a users has enforced to be set should be kept in
> one Map and the others that the components set internally (such as SQL
> number of rows returned, or whatnot we have, there are many) in
> another Map.
>

It means that a component would have to look for header in more than
one place.   Besides, the distinction of user vs system header is not
always clear.  For example, the operation name header for cxf endpoint
can be set by user but it is also created by cxf component.   I am
sure there are many more examples.  There is another header category:
protocol headers.  A protocol header is not really a user or system
header.  Protocol headers are header propagated from protocol like
HTTP, which we do want to preserve in message header.

> The user headers is always preserved and copied along in the routing.
> User can always clear/remove unwanted headers.
> The system headers should be short lived as they are not really
> useable. So they are "alive" in the next step (process) in the route,
> and when the pipeline invokes next route thereafter these information
> is cleared.
>
> Separating these will also make the routing/tracing a bit easier as
> Users can recognize their own headers instead its mixed with all the
> noise the Camel components add.
>

I wonder we can leverage/extend the HeaderFilterStrategy mechanism.
Currently, it is only used for filtering unwanted headers (in both
request and response direction) when we propagate headers between
Camel and external messages (like HTTP).   HeaderFilterStrategy is (or
will be) associated with an endpoint.  We could make
HeaderFilterStrategy available to the exchange object.  So, when an
endpoint creates an exchange, the exchange gets a header filter
strategy.  Then, pipeline can do something like this to filter
unwanted header: message.filterHeaders().   The header filter strategy
is highly customizable for each endpoint (can have a component wide
default) and it can be looked up from registry.

Reply via email to