camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From roger_rabbit <roger_rab...@gmx.fr>
Subject Quartz and enrich seem not to work together...
Date Mon, 22 Jul 2013 18:39:48 GMT
Hi,

I read a few things about the subject, but since most of them were 3 years
old, I guess there are new features that may have changed the issue... so
here's my 2013 problem.

First of all, I am quite new to camel (20 days experience).

In a previous project, I managed to use a quartz-triggered route to get some
informations from a http site and send them as messages on a bus topic
(Fuse).
This worked fine for me.

Now, I am trying to use the same kind of process to manage a file, in such a
way I read the file at a time pointed out by a cron expression, and use the
content of the file to trigger several messages on bus (basicely : one
message will be triggerd per line in file).

Very basicely, this should look like (from my RouteBuilder-implementing
class) :
    from("quartz:mytimer?0+0/2+*+*+*")
    .enrich("file:/my/directory/?fileName=myFile.pair&noop=true")
    .split("\n",1)
    .to("activemq:my.topic.out");

My problem is that the file is processed only for the first quartz event,
and then, never processed again... (even if I change file's content). 
So, what I guess is that it is "consumed" (thus, never read, and that's why
the route failed during the next quartz events),  and that I have to keep
the content of the file in some ... place (topic?/seda?/other?) and enrich
my quartz route from that place without consuming the message...
My problem is, as a noobie, I don't know how to that.
I tried to set a previous route such as :

  
from("file:/my/directory/?fileName=myFile.pair&noop=true").to("direct:file");

and then use as as my enrichment source :

    from("quartz:mytimer?0+0/2+*+*+*")
    .enrich("direct:file")
    .split("\n",1)
    .to("activemq:my.topic.out");

... but the problem was the same... since obviously it is still consumed.

I also tried to use a ConsumerTemplate from a processor to enrich the
exchange with stg like :

Process(Exchange ex){
...
    Exchange newEx =
template.receive("file:/my/directory/?fileName=myFile.pair&noop=true");
    ex.setIn(newEx);
}
... but all the same...

So I tried many things and ended up thinking I .. think the wrong way. So
any tip here would be welcome.


Thanks in advance




--
View this message in context: http://camel.465427.n5.nabble.com/Quartz-and-enrich-seem-not-to-work-together-tp5736046.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message