I don't see where you call the method sendTo(...).
If you don't call it, Camel will put the Exchange ID as the name of your file.


Arnaud Deprez
Analyst-Programmer
Acquiring Back-Office
+32 2 727 72 09
arnaud.dep...@atos.net
Chaussee de Haecht 1442 Haachtsesteenweg
1130 Brussels
Belgium
atosworldline.be

 please don't print unless you really need to

-----Original Message-----
From: Saurabh [mailto:computerfres...@gmail.com]
Sent: mardi 4 septembre 2012 13:42
To: users@camel.apache.org
Subject: Re: Naming your file with org.apache.camel.file.name


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.


Atos Worldline SA/NV - Chaussee de Haecht 1442 Haachtsesteenweg
- 1130 Brussels - Belgium
RPM-RPR Bruxelles-Brussel - TVA-BTW BE 0418.547.872
Bankrekening-Compte Bancaire-Bank Account 310-0269424-44
BIC BBRUBEBB - IBAN BE55 3100 2694 2444

"The information contained in this e-mail and any attachment thereto is 
confidential and may contain information which is protected by intellectual 
property rights.
This information is intended for the exclusive use of the recipient(s) named 
above.
This e-mail does not constitute any binding relationship or offer toward any of 
the addressees.
If you are not one of the addressees , one of their employees or a proxy holder 
entitled to hand over this message to the addressee(s), any use of the 
information contained herein (e.g. reproduction, divulgation, communication or 
distribution,...) is prohibited.
If you have received this message in error, please notify the sender and 
destroy it immediately after.
The integrity and security of this message cannot be guaranteed and it may be 
subject to data corruption, interception and unauthorized amendment, for which 
we accept no liability."

Reply via email to