camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: [PROPOSAL] ProtocolMessage
Date Tue, 24 Jun 2008 13:35:34 GMT
2008/6/23 William Tam <email.wtam@gmail.com>:
> Hi all,
>
> I may be totally off but, it seems that Camel Message headers are
> being used too liberally.   Some headers are added by components for
> doing their jobs with no intention to send them as protocol headers.
> Some headers are objects/non-string and are not suitable to be sent as
> headers anyway.  When an app reads headers from a message, it does not
> really know whether a header is actually a protocol header or
> something that gets added by Camel.  Likewise, when an app needs to
> set some protocol headers, Message.setHeader() does not seem to
> provide that kind of semantics.  So, I am proposing creating a
> ProtocolMessage class that extends DefaultMessage with these methods:
>
> /**
>  * Get protocol header.
>  */
> public List<String> getProtocolHeader(String name) {
> }
>
>
> /**
>  * Set protocol header
>  */
> public void setProtocolHeader(String name, List<String> value) {
> }
>
> For example, CxfMessage will extend ProtocolMessage.  If I call
> CxfMessage.getProtocolHeader(), I get the protocol headers in a CXF
> message not the ones that are added by CxfComponent.
> CxfMessage.getHeader() is unaffected.  Other message types may need to
> be updated as well.
>
> So, what do you think?

I guess the tricky thing is - what is a 'protocol header'?

e.g. take HTTP and JMS as examples; you can specify your own headers
which a receiver may or may not understand. You can do the same with
SOAP. What constitutes a 'protocol header' in the general sense?

Since its such a grey area I'd always kinda thought it was up to an
endpoint to decide what headers it considered part of the protocol.

We could certainly add some kinda header letting folks describe which
headers are expected to be part of the protocol? Or maybe configure -
say - the CXF endpoint to exclude headers of certain
names/shapes/types etc

Another option I guess is to reserve message headers only for protocol
related stuff; and use Exchange properties for anything else?

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Mime
View raw message