You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Charles Moulliard <cm...@gmail.com> on 2009/07/01 10:33:43 UTC

Uri file endpoint question - Camel 2.x

Hi,

I have configured my file endpoint like this :

file://d:/temp/data/notification/${date:now:yyyyMMdd}/${in.header.messageType}-${date:now:hhmmss}.txt

Directory = /d:/temp/data/notification/${date:now:yyyyMMdd}/
FileName = ${in.header.messageType}-${date:now:hhmmss}.txt

Remark : notificationType is well present in the Header of the message
exchange with this endpoint

but Camel generates the following error :

Caused by: java.io.FileNotFoundException:
d:\temp\data\notification\${date:now:yyyyMMdd}\${in.header.messageType}-${date:now:hhmmss}.txt\ID-dell-charles-1778-1246434755850-1-17
(The filename, directory name, or volume label syntax is incorrect)

Where is the issue ?

Regards

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com

Re: Uri file endpoint question - Camel 2.x

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Jul 1, 2009 at 10:49 AM, Charles Moulliard<cm...@gmail.com> wrote:
> Sorry for my mistake ;-)

Yeah there was a tip on the wiki page as well about this. But nice to
know its not that abvious. Maybe Camel should validate this and thrown
an exception if you have ${ in the starting path name.
I think I will add a ticket about this.


Only directories
Camel 2.0 only support endpoints configured with a starting directory.
So the directoryName must be a directory.
If you want to consume a single file only, you can use the fileName
option to only select your filename, e.g. by just setting
fileName=thefilename.

In Camel 1.x you could also configure a file and this caused more harm
than good as it could lead to confusing situations.



>
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
>
> *****************************
> blog : http://cmoulliard.blogspot.com
>
>
> On Wed, Jul 1, 2009 at 10:46 AM, Claus Ibsen <cl...@gmail.com> wrote:
>
>> On Wed, Jul 1, 2009 at 10:33 AM, Charles Moulliard<cm...@gmail.com>
>> wrote:
>> > Hi,
>> >
>> > I have configured my file endpoint like this :
>> >
>> >
>> file://d:/temp/data/notification/${date:now:yyyyMMdd}/${in.header.messageType}-${date:now:hhmmss}.txt
>> >
>> > Directory = /d:/temp/data/notification/${date:now:yyyyMMdd}/
>> > FileName = ${in.header.messageType}-${date:now:hhmmss}.txt
>> >
>> > Remark : notificationType is well present in the Header of the message
>> > exchange with this endpoint
>> >
>> > but Camel generates the following error :
>> >
>> > Caused by: java.io.FileNotFoundException:
>> >
>> d:\temp\data\notification\${date:now:yyyyMMdd}\${in.header.messageType}-${date:now:hhmmss}.txt\ID-dell-charles-1778-1246434755850-1-17
>> > (The filename, directory name, or volume label syntax is incorrect)
>> >
>> > Where is the issue ?
>>
>> The uri should contain the basepath in regular plain string text (its
>> NOT dynamic).
>> So it should be: file://d:/temp/data/notification
>>
>> Then the dynamic part should be in the fileName option, as we want to
>> only poll this file.
>> So it should be:
>> ${date:now:yyyyMMdd}/${in.header.messageType}-${date:now:hhmmss}.txt
>>
>> And the total uri is then:
>>
>> file://d:/temp/data/notification?fileName=${date:now:yyyyMMdd}/${in.header.messageType}-${date:now:hhmmss}.txt
>>
>>
>>
>> >
>> > Regards
>> >
>> > Charles Moulliard
>> > Senior Enterprise Architect
>> > Apache Camel Committer
>> >
>> > *****************************
>> > blog : http://cmoulliard.blogspot.com
>> >
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: Uri file endpoint question - Camel 2.x

Posted by Charles Moulliard <cm...@gmail.com>.
Sorry for my mistake ;-)

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com


On Wed, Jul 1, 2009 at 10:46 AM, Claus Ibsen <cl...@gmail.com> wrote:

> On Wed, Jul 1, 2009 at 10:33 AM, Charles Moulliard<cm...@gmail.com>
> wrote:
> > Hi,
> >
> > I have configured my file endpoint like this :
> >
> >
> file://d:/temp/data/notification/${date:now:yyyyMMdd}/${in.header.messageType}-${date:now:hhmmss}.txt
> >
> > Directory = /d:/temp/data/notification/${date:now:yyyyMMdd}/
> > FileName = ${in.header.messageType}-${date:now:hhmmss}.txt
> >
> > Remark : notificationType is well present in the Header of the message
> > exchange with this endpoint
> >
> > but Camel generates the following error :
> >
> > Caused by: java.io.FileNotFoundException:
> >
> d:\temp\data\notification\${date:now:yyyyMMdd}\${in.header.messageType}-${date:now:hhmmss}.txt\ID-dell-charles-1778-1246434755850-1-17
> > (The filename, directory name, or volume label syntax is incorrect)
> >
> > Where is the issue ?
>
> The uri should contain the basepath in regular plain string text (its
> NOT dynamic).
> So it should be: file://d:/temp/data/notification
>
> Then the dynamic part should be in the fileName option, as we want to
> only poll this file.
> So it should be:
> ${date:now:yyyyMMdd}/${in.header.messageType}-${date:now:hhmmss}.txt
>
> And the total uri is then:
>
> file://d:/temp/data/notification?fileName=${date:now:yyyyMMdd}/${in.header.messageType}-${date:now:hhmmss}.txt
>
>
>
> >
> > Regards
> >
> > Charles Moulliard
> > Senior Enterprise Architect
> > Apache Camel Committer
> >
> > *****************************
> > blog : http://cmoulliard.blogspot.com
> >
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>

Re: Uri file endpoint question - Camel 2.x

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Jul 1, 2009 at 10:33 AM, Charles Moulliard<cm...@gmail.com> wrote:
> Hi,
>
> I have configured my file endpoint like this :
>
> file://d:/temp/data/notification/${date:now:yyyyMMdd}/${in.header.messageType}-${date:now:hhmmss}.txt
>
> Directory = /d:/temp/data/notification/${date:now:yyyyMMdd}/
> FileName = ${in.header.messageType}-${date:now:hhmmss}.txt
>
> Remark : notificationType is well present in the Header of the message
> exchange with this endpoint
>
> but Camel generates the following error :
>
> Caused by: java.io.FileNotFoundException:
> d:\temp\data\notification\${date:now:yyyyMMdd}\${in.header.messageType}-${date:now:hhmmss}.txt\ID-dell-charles-1778-1246434755850-1-17
> (The filename, directory name, or volume label syntax is incorrect)
>
> Where is the issue ?

The uri should contain the basepath in regular plain string text (its
NOT dynamic).
So it should be: file://d:/temp/data/notification

Then the dynamic part should be in the fileName option, as we want to
only poll this file.
So it should be:
${date:now:yyyyMMdd}/${in.header.messageType}-${date:now:hhmmss}.txt

And the total uri is then:
file://d:/temp/data/notification?fileName=${date:now:yyyyMMdd}/${in.header.messageType}-${date:now:hhmmss}.txt



>
> Regards
>
> Charles Moulliard
> Senior Enterprise Architect
> Apache Camel Committer
>
> *****************************
> blog : http://cmoulliard.blogspot.com
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus