camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rspeter <rspe...@yahoo.com>
Subject Camel message -How long custom headers and properties live
Date Mon, 05 Dec 2011 00:25:27 GMT
Good day everyone,

I am using apache-activemq-5.5.1-fuse-00-08 and camel-core-2.8.0-fuse-00-08
and have read about few topics on how to solve the issue with custom headers
and properties.
But I am unable to solve this issue. Any help is appreciated.

Earlier topic on this issue:
http://camel.465427.n5.nabble.com/How-long-do-the-camel-headers-live-in-routes-td474477.html
http://camel.465427.n5.nabble.com/Pass-properties-headers-to-another-endpoint-td477128.html

All headers and properties are visible before the queue but they disappear
once it reaches the JMS queue. 
The properties are worse than headers. I tried to log it after consuming
from the queue and could see one or two headers.

Sample test:
------------
		<route inheritErrorHandler="true">
		    <description>test1</description>
			<from uri="direct:test"/>	
			<log message="before queue: properties"/>	
			<log message="x1:${property.x1}"/>
			<log message="x2:${property.x2}"/>	
			<log message="x3:${property.x3}"/>						
			<log message="x4:${property.x4}"/>
			<doTry>		

				<log message="swap properties to headers"/>				
				<setHeader headerName="a1"><simple>${property.x1}</simple></setHeader>
				<setHeader headerName="b1"><simple>${property.x2}</simple></setHeader>
				<setHeader headerName="c1"><simple>${property.x3}</simple></setHeader>
				<setHeader headerName="d1"><simple>${property.x4}</simple></setHeader>

<setHeader headerName="xyz"><constant>header as constant always
works</constant></setHeader>							
				<inOnly uri="activemq:myqueue1" inheritErrorHandler="true"/>	
				<doCatch>
					<exception>java.lang.Exception</exception>
				</doCatch>
			</doTry>				
		</route>
		
					
		<route inheritErrorHandler="true">
            		<description>test2</description>
		   <from uri="activemq:myqueue1"/>
			<log message="after queue: properties"/>	
			<log message="x1:${property.x1}"/>
			<log message="x2:${property.x2}"/>	
			<log message="x3:${property.x3}"/>						
			<log message="x4:${property.x4}"/>
			
			<log message="after queue: headers"/>	
			<log message="a1:${in.header.a1}"/>		
			<log message="b1:${in.header.b1}"/>	
			<log message="c1:${in.header.c1}"/>		
			<log message="d1:${in.header.d1}"/>	
<log message="xyz:${in.header.xyz}"/>		
		
				
			<inOnly uri="activemq:myqueue2" inheritErrorHandler="true"/> 	
        </route>

The log results:
--------------
 INFO | before queue: properties
 INFO | x1:test
 INFO | x2:aaaa
 INFO | x3:ffffff
 INFO | x4:hello
 INFO | swap properties to headers
 INFO | after queue: properties
 INFO | x1:
 INFO | x2:
 INFO | x3:
 INFO | x4:
 INFO | after queue: headers
 INFO | a1: 
 INFO | b1:aaaa
 INFO | c1:ffffff
 INFO | d1:hello
INFO | xyz:header as constant always works

All properties are not visible, but some headers are visible except a1. 
Claus, Roman were suggesting to use property instead of headers, but I
couldn't get it working. 
Could you please suggest?

Regards
Peter


--
View this message in context: http://camel.465427.n5.nabble.com/Camel-message-How-long-custom-headers-and-properties-live-tp5047495p5047495.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message