You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by adi milis <mi...@gmail.com> on 2011/03/16 13:30:09 UTC

moving file with camel

Hi,

I want to create simple routing in camel, to filter and move file

the case, I have one input folder, depends on the extention, it will be
moved to other folder

my routings are
try {
            context.addRoutes(new RouteBuilder() {
                public void configure() {

 from("file:data/inbox?noop=false&include=*.png").to("file:data/png");
                }
            });
        } catch (Exception e) {
            System.out.println(e.getMessage());
}

however, i got the following errors ..

WARNING: Consumer Consumer[file://data/inbox?include=*.png&noop=false] could
not poll endpoint: file://data/inbox?include=*.png&noop=false caused by:
Dangling meta character '*' near index 0
*.png
^
java.util.regex.PatternSyntaxException: Dangling meta character '*' near
index 0
*.png
^
        at java.util.regex.Pattern.error(Pattern.java:1713)

any idea what i'm missing here ?

Re: moving file with camel

Posted by "Allan C." <al...@gmail.com>.
I think using timer/quartz with content enricher (pollEnrich) could be your
solution.

Regards,
Allan C.

On Tue, Dec 6, 2016 at 4:46 PM, Jan Matèrne (jhm) <ap...@materne.de> wrote:

> > -I want to filter multiple format file (as .html,.jpg...).How can I do
> > it?
>
> You could read only these files:
> http://camel.apache.org/file2.html
> Option "fileName": For consumers, it's used as a filename filter.
> Or Options include/antInclude/exclude/antExclude
>
> Or you use a content based router on the message header "CamelFileName".
>
>
>
> > -I want to set time (time format only includes hours as 04:00) for
> > route moving file.Please give me some advice.
>
> Not clear to me, what you mean.
>
>
> Jan
>
>

AW: moving file with camel

Posted by "Jan Matèrne (jhm)" <ap...@materne.de>.
> -I want to filter multiple format file (as .html,.jpg...).How can I do
> it?

You could read only these files:
http://camel.apache.org/file2.html
Option "fileName": For consumers, it's used as a filename filter.
Or Options include/antInclude/exclude/antExclude

Or you use a content based router on the message header "CamelFileName".



> -I want to set time (time format only includes hours as 04:00) for
> route moving file.Please give me some advice.

Not clear to me, what you mean.


Jan


Re: moving file with camel

Posted by axdz <ho...@gmail.com>.
Dear,

-I want to filter multiple format file (as .html,.jpg...).How can I do it?
-I want to set time (time format only includes hours as 04:00) for route
moving file.Please give me some advice.

Thanks,



--
View this message in context: http://camel.465427.n5.nabble.com/moving-file-with-camel-tp3779591p5791071.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: moving file with camel

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Mar 16, 2011 at 2:42 PM, adi milis <mi...@gmail.com> wrote:
> Thanks .. It works now
>
> btw, I got the code from the first chapter of your book in amazon,
> in Easy Configuration section, the code doesnt even mention about regex.

Jonathan updated chapter 2 to mention regexp and show how to filter
only XML files.
Will be in the updated book, when Manning does a 2nd print.

>
>
>
> On Wed, Mar 16, 2011 at 7:39 PM, Claus Ibsen <cl...@gmail.com> wrote:
>
>> Hi
>>
>> The include option is using Java Reg Exp so you have to configure that
>> with a valid regexp.
>>
>> So to only include PNG files you do like this: .*png$
>> This is a reg exp to match a string ending with png.
>>
>>
>>
>> On Wed, Mar 16, 2011 at 1:30 PM, adi milis <mi...@gmail.com> wrote:
>> > Hi,
>> >
>> > I want to create simple routing in camel, to filter and move file
>> >
>> > the case, I have one input folder, depends on the extention, it will be
>> > moved to other folder
>> >
>> > my routings are
>> > try {
>> >            context.addRoutes(new RouteBuilder() {
>> >                public void configure() {
>> >
>> >  from("file:data/inbox?noop=false&include=*.png").to("file:data/png");
>> >                }
>> >            });
>> >        } catch (Exception e) {
>> >            System.out.println(e.getMessage());
>> > }
>> >
>> > however, i got the following errors ..
>> >
>> > WARNING: Consumer Consumer[file://data/inbox?include=*.png&noop=false]
>> could
>> > not poll endpoint: file://data/inbox?include=*.png&noop=false caused by:
>> > Dangling meta character '*' near index 0
>> > *.png
>> > ^
>> > java.util.regex.PatternSyntaxException: Dangling meta character '*' near
>> > index 0
>> > *.png
>> > ^
>> >        at java.util.regex.Pattern.error(Pattern.java:1713)
>> >
>> > any idea what i'm missing here ?
>> >
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> FuseSource
>> Email: cibsen@fusesource.com
>> Web: http://fusesource.com
>> Twitter: davsclaus
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>>
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: moving file with camel

Posted by adi milis <mi...@gmail.com>.
Thanks .. It works now

btw, I got the code from the first chapter of your book in amazon,
in Easy Configuration section, the code doesnt even mention about regex.



On Wed, Mar 16, 2011 at 7:39 PM, Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> The include option is using Java Reg Exp so you have to configure that
> with a valid regexp.
>
> So to only include PNG files you do like this: .*png$
> This is a reg exp to match a string ending with png.
>
>
>
> On Wed, Mar 16, 2011 at 1:30 PM, adi milis <mi...@gmail.com> wrote:
> > Hi,
> >
> > I want to create simple routing in camel, to filter and move file
> >
> > the case, I have one input folder, depends on the extention, it will be
> > moved to other folder
> >
> > my routings are
> > try {
> >            context.addRoutes(new RouteBuilder() {
> >                public void configure() {
> >
> >  from("file:data/inbox?noop=false&include=*.png").to("file:data/png");
> >                }
> >            });
> >        } catch (Exception e) {
> >            System.out.println(e.getMessage());
> > }
> >
> > however, i got the following errors ..
> >
> > WARNING: Consumer Consumer[file://data/inbox?include=*.png&noop=false]
> could
> > not poll endpoint: file://data/inbox?include=*.png&noop=false caused by:
> > Dangling meta character '*' near index 0
> > *.png
> > ^
> > java.util.regex.PatternSyntaxException: Dangling meta character '*' near
> > index 0
> > *.png
> > ^
> >        at java.util.regex.Pattern.error(Pattern.java:1713)
> >
> > any idea what i'm missing here ?
> >
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>

Re: moving file with camel

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

The include option is using Java Reg Exp so you have to configure that
with a valid regexp.

So to only include PNG files you do like this: .*png$
This is a reg exp to match a string ending with png.



On Wed, Mar 16, 2011 at 1:30 PM, adi milis <mi...@gmail.com> wrote:
> Hi,
>
> I want to create simple routing in camel, to filter and move file
>
> the case, I have one input folder, depends on the extention, it will be
> moved to other folder
>
> my routings are
> try {
>            context.addRoutes(new RouteBuilder() {
>                public void configure() {
>
>  from("file:data/inbox?noop=false&include=*.png").to("file:data/png");
>                }
>            });
>        } catch (Exception e) {
>            System.out.println(e.getMessage());
> }
>
> however, i got the following errors ..
>
> WARNING: Consumer Consumer[file://data/inbox?include=*.png&noop=false] could
> not poll endpoint: file://data/inbox?include=*.png&noop=false caused by:
> Dangling meta character '*' near index 0
> *.png
> ^
> java.util.regex.PatternSyntaxException: Dangling meta character '*' near
> index 0
> *.png
> ^
>        at java.util.regex.Pattern.error(Pattern.java:1713)
>
> any idea what i'm missing here ?
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/