Hi

I recon there is something in all you code that messes up the Camel headers.
You could just try a very simple route to see if it can pickup the
files and just move them to .camel

Here is output from my test

/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/bin/java
-Dfile.encoding=MacRoman -classpath /Applications/IntelliJ IDEA 9.0
CE.app/plugins/junit/lib/junit-rt.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/deploy.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/dt.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/jce.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/plugin.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/sa-jdi.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/charsets.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/classes.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/jconsole.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/jsse.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/laf.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/ui.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/apple_provider.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/dnsns.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/localedata.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/sunjce_provider.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/sunpkcs11.jar:/workspace/camel/camel-core/target/test-classes:/workspace/camel/camel-core/target/classes:/Users/davsclaus/.m2/repository/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar:/Users/davsclaus/.m2/repository/org/fusesource/commonman/commons-management/1.0/commons-management-1.0.jar:/Users/davsclaus/.m2/repository/org/springframework/spring-context/2.5.6/spring-context-2.5.6.jar:/Users/davsclaus/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar:/Users/davsclaus/.m2/repository/junit/junit/3.8.2/junit-3.8.2.jar:/Users/davsclaus/.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar:/Users/davsclaus/.m2/repository/org/springframework/spring-aop/2.5.6/spring-aop-2.5.6.jar:/Users/davsclaus/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar:/Users/davsclaus/.m2/repository/org/springframework/spring-beans/2.5.6/spring-beans-2.5.6.jar:/Users/davsclaus/.m2/repository/org/springframework/spring-core/2.5.6/spring-core-2.5.6.jar:/Users/davsclaus/.m2/repository/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar:/Users/davsclaus/.m2/repository/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar:/Users/davsclaus/.m2/repository/javax/activation/activation/1.1/activation-1.1.jar:/Users/davsclaus/.m2/repository/com/sun/xml/bind/jaxb-impl/2.1.12/jaxb-impl-2.1.12.jar:/Applications/IntelliJ
IDEA 9.0 CE.app/lib/idea_rt.jar
com.intellij.rt.execution.junit.JUnitStarter -ideVersion5
org.apache.camel.component.file.FileAbsoluteMoveDefaultIssueTest
2010-04-07 14:08:20,460 [main           ] INFO  DefaultCamelContext
        - Apache Camel  (CamelContext: camel-1) is starting
2010-04-07 14:08:20,461 [main           ] INFO  DefaultCamelContext
        - JMX is disabled. Using DefaultManagementStrategy.
2010-04-07 14:08:20,902 [main           ] INFO  DefaultCamelContext
        - Route: route1 started and consuming from:
Endpoint[file:///opt/feeds/ebook/in?include=.*%5C.txt&sortBy=file%3Aname]
2010-04-07 14:08:20,903 [main           ] INFO  DefaultCamelContext
        - Started 1 routes
2010-04-07 14:08:20,904 [main           ] INFO  DefaultCamelContext
        - Apache Camel  (CamelContext: camel-1) started
2010-04-07 14:08:20,936 [main           ] INFO  MockEndpoint
        - Asserting: Endpoint[mock://result] is satisfied
2010-04-07 14:08:21,917 [tBy=file%3Aname] INFO  foo
        - Exchange[Id:152d5d0c-f13d-443c-a39b-022c67baa5bb,
ExchangePattern:InOnly, Properties:{CamelBatchComplete=true,
CamelToEndpoint=log://foo?showAll=true, CamelBatchSize=1,
CamelFileLock=/opt/feeds/ebook/in/hello.txt.camelLock,
CamelBatchIndex=0,
CamelFileExchangeFile=GenericFile[/opt/feeds/ebook/in/hello.txt],
CamelFileLockName=/opt/feeds/ebook/in/hello.txt.camelLock},
Headers:{FILE_ID=hello, CamelFileLastModified=Wed Apr 07 14:08:20 CEST
2010, CamelFileRelativePath=/opt/feeds/ebook/in/hello.txt,
CamelFileAbsolute=true, CamelFileNameOnly=hello.txt,
CamelFilePath=/opt/feeds/ebook/in/hello.txt, CamelFileName=hello.txt,
CamelFileParent=/opt/feeds/ebook/in, CamelFileLength=11,
CamelFileAbsolutePath=/opt/feeds/ebook/in/hello.txt}, BodyType:String,
Body:Hello World, Out: null]
2010-04-07 14:08:21,924 [tBy=file%3Aname] TRACE GenericFile
        - Changing name to: /opt/feeds/ebook/in/.camel/hello.txt
2010-04-07 14:08:21,924 [main           ] INFO  DefaultCamelContext
        - Apache Camel  (CamelContext:camel-1) is shutting down
2010-04-07 14:08:21,929 [tBy=file%3Aname] TRACE GenericFile
        - Normalized endpointPath: /opt/feeds/ebook/in
2010-04-07 14:08:21,930 [tBy=file%3Aname] TRACE GenericFile
        - Normalized newFileName: /opt/feeds/ebook/in/.camel/hello.txt
2010-04-07 14:08:21,929 [main           ] INFO
DefaultShutdownStrategy        - Starting to graceful shutdown 1
routes (timeout 10 seconds)
2010-04-07 14:08:21,930 [tBy=file%3Aname] TRACE GenericFile
        - FileNameOnly: hello.txt
2010-04-07 14:08:21,931 [tBy=file%3Aname] TRACE GenericFile
        - FileName: hello.txt
2010-04-07 14:08:21,932 [tBy=file%3Aname] TRACE GenericFile
        - Absolute: true
2010-04-07 14:08:21,932 [tBy=file%3Aname] TRACE GenericFile
        - Relative path: /opt/feeds/ebook/in/.camel/hello.txt
2010-04-07 14:08:21,932 [tBy=file%3Aname] TRACE GenericFile
        - Absolute path: /opt/feeds/ebook/in/.camel/hello.txt
2010-04-07 14:08:21,933 [tBy=file%3Aname] TRACE GenericFile
        - Name changed to:
GenericFile[/opt/feeds/ebook/in/.camel/hello.txt]
2010-04-07 14:08:21,933 [ - ShutdownTask] INFO
DefaultShutdownStrategy        - Route: route1 suspended and shutdown
deferred, was consuming from:
Endpoint[file:///opt/feeds/ebook/in?include=.*%5C.txt&sortBy=file%3Aname]
2010-04-07 14:08:21,935 [ - ShutdownTask] INFO
DefaultShutdownStrategy        - Route: route1 shutdown complete.
2010-04-07 14:08:21,935 [main           ] INFO
DefaultShutdownStrategy        - Graceful shutdown of 1 routes
completed in 0 seconds
2010-04-07 14:08:21,936 [main           ] INFO
DefaultInflightRepository      - Shutting down with no inflight
exchanges.
2010-04-07 14:08:21,937 [main           ] INFO  DefaultCamelContext
        - Apache Camel  (CamelContext: camel-1) is shutdown

Process finished with exit code 0

In a simple uni tests

public class FileAbsoluteMoveDefaultIssueTest extends ContextTestSupport {

    @Override
    protected void setUp() throws Exception {
        deleteDirectory("opt/feeds/");
        super.setUp();
    }

    public void testAbsolute() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedBodiesReceived("Hello World");
        mock.expectedFileExists("/opt/feeds/ebook/in/.camel/hello.txt");

        template.sendBodyAndHeader("file:/opt/feeds/ebook/in", "Hello
World", Exchange.FILE_NAME, "hello.txt");

        assertMockEndpointsSatisfied();
    }

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {

from("file:/opt/feeds/ebook/in?sortBy=file:name&include=.*\\.txt")
                        .convertBodyTo(String.class)
                        .setHeader("FILE_ID",
SimpleLanguage.simple("${file:onlyname.noext}"))
                        .to("log:foo?showAll=true")
                        .to("mock:result");
            }
        };
    }
}





On Wed, Apr 7, 2010 at 2:06 PM, Claus Ibsen <claus.ib...@gmail.com> wrote:
> Hi
>
> Try using the Tracer and/or add this logging to the end of your route
>                        .to("log:foo?showAll=true")
>
> It could be something in all your processors and whatnot which messes
> with the headers.
>
> I have created an unit test on my system and it works all the time.
>
>
>
> On Wed, Apr 7, 2010 at 11:35 AM, Nick Mitchell <nick.mitch...@hmv.co.uk> 
> wrote:
>>
>> from(cronTriggerExpression)
>>                       .pollEnrich(ebookRemoteFTPIn,0)
>>        .idempotentConsumer(header("CamelFileName"),filenameRepository)
>>                .to(ebookIn);
>>
>>           from(ebookIn)
>>                        .process( new 
>> SetupChildRouteRuntime(metaRouteId,childRouteId+0,
>> baseDao) )
>>                        .unmarshal(new XMLebookDataFormat())
>>                        .process(new CSVebookProcessor(ebookOut,
>>                                                                ebookTable,
>>                                                                authorTable,
>>                                                                drminfoTable,
>>                                                        ebookSubjectTable,
>>                                                        
>> abstractBook2BiccodeTable,
>>                                                        bisacBicDao,
>>                                                        bicClassificationDao,
>>                                                        
>> ebooksOtherFormatsTable,
>>                                                        ebooksExcerptTable,
>>                                                        ebookDigitalInfoTable,
>>                                                        
>> ebooksOtherTitlesTable,
>>                                                        publisherTable,
>>                                                        imprintTable,
>>                                                        catalogDao,
>>                                                        productDao,
>>                                                        composedTypeDao,
>>                                                        etlStats,
>>                                                        true,
>>                                                        currentVatRate
>>                                                                ) )
>>        .setHeader("FILE_ID",
>> SimpleLanguage.simple("${file:onlyname.noext}"))
>>        .process(new ZipProcessorHybris(ebookOut, ebookZipOut,
>> ebookOutFileName, true, ebookZipIn,
>>                        0L, "[_.]","_{0}_{date}",etlStats))
>>        .process(new EmailProcessor(mailService,etlStats,ebookZipIn))
>>        .process( new EtlProcessSuccess(baseDao))
>>            .process(new CleanExchange())
>>            .delay().method( "com.lbi.etl.utils.beans.Delayer", "forceGC" );
>>
>> I've tried to fill in some constants so it makes a bit more sense to you.
>> The processors in the route don't really do much. Basically the route polls
>> for an XML file, processes the XML file, converts to a csv format, puts the
>> output file in a different directory and emails to say successful.
>>
>> Cheers
>> Nick
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> Hi
>>>
>>> Could you post your route? I will then use it to reproduce the issue
>>> on my laptop.
>>>
>>>
>>> On Wed, Apr 7, 2010 at 10:45 AM, Nick Mitchell <nick.mitch...@hmv.co.uk>
>>> wrote:
>>>>
>>>> We are setting FILE_ID in the header
>>>>
>>>> .setHeader(FILE_ID, SimpleLanguage.simple("${file:onlyname.noext}"))
>>>>
>>>> If I change the file expression to ${file:name.ext} then it does move it
>>>> to
>>>> .camel folder. I confused as to why it worked before and not now though.
>>>> --
>>>> View this message in context:
>>>> http://old.nabble.com/FileComponent-Camel-2.2-tp28154602p28162146.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>>
>>>
>>
>> --
>> View this message in context: 
>> http://old.nabble.com/FileComponent-Camel-2.2-tp28154602p28162632.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to