camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Saurabh <computerfres...@gmail.com>
Subject Re: Naming your file with org.apache.camel.file.name
Date Tue, 04 Sep 2012 11:41:31 GMT
Hi Friends,

I am working on a small spike in which my task is to pick an xml from a
directory, put it on jms queue and save the xml to some other directory.

This is the code snapshot, this is after I converted the file contents in to
a string.

private static final String URI = "activemq://queue:test.MyQueue"  ;

protected void sendTo(String uri,String message) throws Exception {
		ProducerTemplate producerTemplate = camelContext.createProducerTemplate();
		Exchange exchange = new DefaultExchange(camelContext,
ExchangePattern.InOut);
		exchange.getIn().setBody(message);
		Message camelMessage = exchange.getIn();
		camelMessage.setHeader(Exchange.FILE_NAME, "testmesage");
		System.out.println(exchange.getExchangeId());
		System.out.println(exchange.getIn().getMessageId());
		
		producerTemplate.send(uri, exchange);
		Thread.sleep(1000);
	}

and camel route is 
    <route>
    	<from uri="jms:test.MyQueue"/>
    	<to uri="file://target/test?noop=true/>
    </route>

The file appears in target but with name 
ID-localhost-46447-1346755756577-0-2-2-1-1

and not "testmessage" as I specified.

hope I am clear
Please help

Thanks in advance
Saurabh






--
View this message in context: http://camel.465427.n5.nabble.com/Naming-your-file-with-org-apache-camel-file-name-tp473074p5718602.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message