camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From duncanto <tom_dun...@btinternet.com>
Subject Re: How to make a copy an Exchange in a Route segment
Date Thu, 09 Jan 2014 15:09:28 GMT
Thanks for your suggestions .. which Ive tried but without success ... 

Ill clarify the problem with some noddy route code ..  

Cheers 


context.addRoutes(new RouteBuilder() {
			public void configure() throws Exception {

				from("direct:start").setBody().constant("outer body")
						.setHeader("foo").constant("myfoo").
						setHeader("bar").constant("mybar")
						.choice()
						   .when(header("foo").isEqualTo("myfoo"))
						   	// !!!! Is there a DSL definition I can add here to create a copy
of the message exchange
						    // passed to the fooRoute and protect the outer exchange  ???? 
						   .removeHeaders("*", "foo")   // remove all but keep the foo header
						   .to("direct:fooRoute")
						.end()
						// dont want the bar header to be removed at this point  
						// dont want message body changed in the fooRoute to be in scope here  
						.log( "main flow - foo header is : ${header.foo}")
						.log( "main flow - bar header is : ${header.bar}")
						.log( "main flow - body is : ${body}")
						.log("finished");
						
				
				from("direct:fooRoute")
				.setBody().constant("foo body")
				// ok :o) with bar header being removed 
				.log( "foo flow - foo header is : ${header.foo}")
				.log( "foo flow - bar header is : ${header.bar}")
			    .log( "foo flow - body is : ${body}")
				.log("foo route finished")
				// continue with further processing etc etc 
				.end();
				
			}
		});



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-make-a-copy-an-Exchange-in-a-Route-segment-tp5745772p5745792.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message