The message header value could not be Serializable and camel cannot decide 
which header need to be put into the cache, and if you put a map instance into 
the message header it could make the things worse. I think you can take 
advantage of the Camel TypeConverter[1] by apply your customer converter which 
can turn the message body with the header to be the object you want to set to 
the Cache.

[1]http://camel.apache.org/type-converter.html
-- 
Willem Jiang
Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
          http://jnn.iteye.com (Chinese)
Twitter: willemjiang 
Weibo: 姜宁willem


On December 3, 2013 at 10:18:05 PM, shindito ([email protected]) wrote:
>
>I don't think that the persistence configuration influences how the cache
>component writes the exchanges into the cache.
>When performing add or update operations, the
>*org.apache.camel.component.cache.CacheProducer* class uses its
>createElementFromBody() method which takes the in message body from the
>exchange and creates a cache element from it. The message headers are not
>considered at all, thus the headers loss.
>
>Unfortunately, it seems that whether headers should be considered when
>creating the cache element is not customizable.
>
>*@Camel team*: what is you recommendation for this use case: we put some
>custom headers when creating a message and need them on the consumer side
>(after they have been sent to and consumed from the cache component)?
>One option would be to story the headers as part of the body before passing
>the message to the cache, and then extracting them back from it before the
>consumed message is passed to the processor, but will add overhead that we
>would like to avoid.
>
>Best regards,
>Atanas
>
>
>
>--
>View this message in context: 
>http://camel.465427.n5.nabble.com/Persist-headers-when-using-cache-tp5744069p5744244.html
>Sent from the Camel - Users mailing list archive at Nabble.com.
>

Reply via email to