Thanks Arnaud for the reply I feel I was not able to describe myself fully in my last post. In the example below I am picking a xml file src/data/message1.xml and putting it in a queue test.MyQueue.
After listen this using camel, as shown in camel context and pass this message in target/test folder. Here I am getting exchangeId as file name rather than name "testmesage" that I specified. Integration test class is : public class AppTest extends TestCase { protected CamelContext camelContext; private static final String URI = "activemq://queue:test.MyQueue" ; BrokerService broker; public void setUp() throws Exception{ ApplicationContext applicationContext = new ClassPathXmlApplicationContext("META-INF/spring/camel-context.xml"); camelContext = (CamelContext)applicationContext.getBean("camel"); broker = new BrokerService(); broker.addConnector("tcp://localhost:61616"); broker.start(); } 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); } public void testMeth() throws Exception { File file = new File("src/data/message1.xml"); FileReader fileReader = new FileReader(file); BufferedReader bufferedReader = new BufferedReader(fileReader); String message= null; String str=null; while( ( (str=bufferedReader.readLine()) != null)) { message=message+str; } sendTo(URI, message); } public void tearDown() { } } camel route in camel-context.xml is : <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="jms:test.MyQueue"/> <to uri="file://target/test?noop=true/> </route> </camelContext> Thanks Saurabh thecafetechno.com -- View this message in context: http://camel.465427.n5.nabble.com/Naming-your-file-with-org-apache-camel-file-name-tp473074p5718605.html Sent from the Camel - Users mailing list archive at Nabble.com.