camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ankelee <andreasasm...@gmail.com>
Subject Testing and dynamic filenames.
Date Tue, 13 Apr 2010 09:06:08 GMT

Hello

Using Camel 2.3.0 SNAPSHOT I've made a route where I use a wireTap to back
up any incoming files and timestamp the filename like so:

from("file://" + props.getProperty("directory.incoming"))
		.routeId("processing")
	
.setHeader("backupFileName").simple("${date:now:yyyyMMddHH}/${file:name}.bak")
		.wireTap("file://" + props.getProperty("directory.incoming.backup")+
"?fileName=${in.header.backupFileName}")...and so on.

I want to test that the backups are created and would like to do something
like this:

		String filename;
		RouteDefinition route = context.getRouteDefinition("processing");
		route.adviceWith(new RouteBuilder() {
			public void configure() throws Exception { 
				intercept().process(new Processor() {
					@Override
					public void process(Exchange ex) throws Exception {
						filename = ex.getIn().getHeader("backupFileName", String.class);
					}
				});
				} 
			});

Obviously this doesn't work since 'filename' is out of scope for the
Processor. Can I access the header using normal Java or do you have any
ideas how to do this? Maybe I have to reconsider how to test the backup
part?
-- 
View this message in context: http://old.nabble.com/Testing-and-dynamic-filenames.-tp28221755p28221755.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message