Camel will place the headers as camel exchange headers that will be converted automatically to JMS properties.
http://camel.apache.org/jms.html
Message format when sending
The exchange that is sent over the JMS wire must conform to the JMS Message spec.
For the exchange.in.header the following rules apply for the header keys:
- Keys starting with JMS or JMSX are reserved.
- exchange.in.headers keys must be literals and all be valid Java identifiers (do not use dots in the key name).
- Camel replaces dots & hyphens and the reverse when when consuming JMS messages:
. is replaced by _DOT_ and the reverse replacement when Camel consumes the message.
- is replaced by _HYPHEN_ and the reverse replacement when Camel consumes the message. - See also the option jmsKeyFormatStrategy, which allows use of your own custom strategy for formatting keys.
For the exchange.in.header, the following rules apply for the header values:
- The values must be primitives or their counter objects (such as Integer, Long, Character). The types, String, CharSequence, Date, BigDecimal and BigInteger are all converted to their toString() representation. All other types are dropped.
Camel will log with category org.apache.camel.component.jms.JmsBinding at DEBUG level if it drops a given header value. For example:
2008-07-09 06:43:04,046 [main ] DEBUG JmsBinding
- Ignoring non primitive header: order of class: org.apache.camel.component.jms.issues.DummyOrder with value: DummyOrder{orderId=333, itemId=4444, quantity=2}
Message format when receiving
Camel adds the following properties to the Exchange when it receives a message:
Property | Type | Description |
---|---|---|
org.apache.camel.jms.replyDestination | javax.jms.Destination | The reply destination. |
Camel adds the following JMS properties to the In message headers when it receives a JMS message:
Header | Type | Description |
---|---|---|
JMSCorrelationID | String | The JMS correlation ID. |
JMSDeliveryMode | int | The JMS delivery mode. |
JMSDestination | javax.jms.Destination | The JMS destination. |
JMSExpiration | long | The JMS expiration. |
JMSMessageID | String | The JMS unique message ID. |
JMSPriority | int | The JMS priority (with 0 as the lowest priority and 9 as the highest). |
JMSRedelivered | boolean | Is the JMS message redelivered. |
JMSReplyTo | javax.jms.Destination | The JMS reply-to destination. |
JMSTimestamp | long | The JMS timestamp. |
JMSType | String | The JMS type. |
JMSXGroupID | String | The JMS group ID. |
As all the above information is standard JMS you can check the JMS documentation for further details.
http://camel.apache.org/how-to-remove-the-http-protocol-headers-in-the-camel-message.html
In camel there are a number of components that use the http protocol headers to do their business.
The components include camel-http, camel-jetty, camel-restlet, camel-cxf, etc.
If you are using these component, you may pay attention to the Http protocol headers:
Exchange.CONTENT_ENCODING
Exchange.CONTENT_TYPE
Exchange.HTTP_BASE_URI
Exchange.HTTP_CHARACTER_ENCODING
Exchange.HTTP_METHOD
Exchange.HTTP_PATH
Exchange.HTTP_QUERY
Exchange.HTTP_RESPONSE_CODE
If you don't want these headers to bother your other endpoints, you can remove these headers as follows:
from("jetty://http://myhost:9000/myservice/")
// Remove the header which name is start with CamelHttp, this DSL is new to Camel 2.3.0
// You can use removeHeader if your camel version is lower than 2.3.0
.removeHeaders("CamelHttp*")
.to("otherEndpoint");
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="jetty://http://myhost:9000/myservice/"/> <removeHeaders pattern="CamelHttp*" /> <to uri="otherEndpoint"/> </route> </camelContext>
===http://camel.465427.n5.nabble.com/How-long-do-the-camel-headers-live-in-routes-td474477.html
You can use exchange properties for this. You do it using
setProperty() instead of setHeader() and they live as long as the
flow.
Headers can be lost at endpoints basically as they usually represent
some component specific things (request headers in http protocol are
different than response headers, so they simply have to be lost).