You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by sub3 <st...@subwest.com> on 2009/10/09 16:55:45 UTC
Upgrading to 2.0 - Using FileExchange
I am trying to upgrade my system from 1.3.0 to 2.0.0. I can't seem to find
org.apache.camel.component.file.FileExchange.
When I look at the javadocs online, it is there, but I can't find it in any
of the jars. Do I need to compile it myself, or am I just overlooking
something?
Thanks for your help.
--
View this message in context: http://www.nabble.com/Upgrading-to-2.0---Using-FileExchange-tp25822604p25822604.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Upgrading to 2.0 - Using FileExchange
Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Oct 13, 2009 at 6:01 AM, Claus Ibsen <cl...@gmail.com> wrote:
> On Tue, Oct 13, 2009 at 1:57 AM, sub3 <st...@subwest.com> wrote:
>>
>> Thanks, that helped. I also forgot the context.start() too, which caused the
>> last problem.
>>
>> If you don't mind, I have one follow up question:
>> In Camel 1.3.0, when I used 'from("file://directory?delete=true")' and I
>> shutdown the system before finishing the file, I was left with a
>> file.txt.camelLock in that directory.
>> On startup, the system would still read that file (I guess it knew the file
>> wasn't really locked). In 2.0.0, it doesn't read this file, it waits for me
>> to delete this file.
>>
>> Is there anyway to force Camel to re-read this file, or do I just have an
>> external process delete this lock file before I startup?
>>
>
> No you have to manually delete the lock files before starting.
>
> But I do think it would be a good idea to offer such an option on
> Camel itself so it can do that in case it has been killed.
> We are working on in the future to let Camel graceful shutdown and
> thus complete any in progress exchanges so that when you
> shut it down the should not be any more lock files.
>
>
I have created a ticket to track this
https://issues.apache.org/activemq/browse/CAMEL-2082
>> Thanks.
>>
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> On Mon, Oct 12, 2009 at 3:50 PM, sub3 <st...@subwest.com> wrote:
>>>>
>>>> Thanks. That got me past the compilation errors, but I am not able to
>>>> get it
>>>> to trigger in 2.0.
>>>>
>>>> Below is the same code from when I was integrated with 1.3.0 (Except
>>>> removing FileExchange). I don't know if the file handling is correct,
>>>> but
>>>> my problem is that I don't even get to that code. process() never gets
>>>> called when files are dropped in. Is there something new I need to do?
>>>> Thanks.
>>>>
>>>
>>> This code
>>>> File file = (File)e.getIn();
>>>
>>> Should be
>>> File file = e.getIn().getBody(File.class);
>>>
>>> What does the string "dir" contain?
>>>
>>> You can always try to simplify by doing
>>> from("file://" + dir).to("log:foo");
>>>
>>> And have logging at INFO level.
>>> To see if the files is picked up.
>>>
>>>
>>>
>>>>
>>>> from("file://"+dir).errorHandler(deadLetterChannel("bean:DeadLetterChannelProcessor/handleError").maximumRedeliveries(1)).process(new
>>>> Processor() {
>>>> public void process(Exchange e) {
>>>> logger.error("Exchanged called!!!");
>>>> try {
>>>> File file = (File)e.getIn();
>>>> logger.debug("Filename: " + file.toString());
>>>> long start = System.currentTimeMillis();
>>>> FileInputStream fis = new FileInputStream(file);
>>>> handle(fis, file);
>>>> fis.close();
>>>> long end = System.currentTimeMillis();
>>>> logger.info(String.format( "Runtime %1$d ms (%2$d to
>>>> %3$d)",(end -
>>>> start), start, end));
>>>> } catch (Exception ex) {
>>>> ex.printStackTrace();
>>>> }
>>>> }
>>>> });
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Claus Ibsen-2 wrote:
>>>>>
>>>>> On Fri, Oct 9, 2009 at 4:55 PM, sub3 <st...@subwest.com> wrote:
>>>>>>
>>>>>> I am trying to upgrade my system from 1.3.0 to 2.0.0. I can't seem to
>>>>>> find
>>>>>> org.apache.camel.component.file.FileExchange.
>>>>>>
>>>>>> When I look at the javadocs online, it is there, but I can't find it in
>>>>>> any
>>>>>> of the jars. Do I need to compile it myself, or am I just overlooking
>>>>>> something?
>>>>>>
>>>>>
>>>>> The javadocs online is outdated. The apache infrastructure is playing
>>>>> tricks on us so we cant always update it when we do new releases.
>>>>>
>>>>> In Camel 2.0 there is only a single Exchange now =
>>>>> org.apache.camel.impl.DefaultExchange.
>>>>> There are no more specialized exchanges.
>>>>>
>>>>>
>>>>>
>>>>>> Thanks for your help.
>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/Upgrading-to-2.0---Using-FileExchange-tp25822604p25822604.html
>>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Claus Ibsen
>>>>> Apache Camel Committer
>>>>>
>>>>> Open Source Integration: http://fusesource.com
>>>>> Blog: http://davsclaus.blogspot.com/
>>>>> Twitter: http://twitter.com/davsclaus
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Upgrading-to-2.0---Using-FileExchange-tp25822604p25856153.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>>
>>>
>>
>> --
>> View this message in context: http://www.nabble.com/Upgrading-to-2.0---Using-FileExchange-tp25822604p25865126.html
>> Sent from the Camel - Users mailing list archive at Nabble.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: Upgrading to 2.0 - Using FileExchange
Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Oct 13, 2009 at 1:57 AM, sub3 <st...@subwest.com> wrote:
>
> Thanks, that helped. I also forgot the context.start() too, which caused the
> last problem.
>
> If you don't mind, I have one follow up question:
> In Camel 1.3.0, when I used 'from("file://directory?delete=true")' and I
> shutdown the system before finishing the file, I was left with a
> file.txt.camelLock in that directory.
> On startup, the system would still read that file (I guess it knew the file
> wasn't really locked). In 2.0.0, it doesn't read this file, it waits for me
> to delete this file.
>
> Is there anyway to force Camel to re-read this file, or do I just have an
> external process delete this lock file before I startup?
>
No you have to manually delete the lock files before starting.
But I do think it would be a good idea to offer such an option on
Camel itself so it can do that in case it has been killed.
We are working on in the future to let Camel graceful shutdown and
thus complete any in progress exchanges so that when you
shut it down the should not be any more lock files.
> Thanks.
>
>
>
> Claus Ibsen-2 wrote:
>>
>> On Mon, Oct 12, 2009 at 3:50 PM, sub3 <st...@subwest.com> wrote:
>>>
>>> Thanks. That got me past the compilation errors, but I am not able to
>>> get it
>>> to trigger in 2.0.
>>>
>>> Below is the same code from when I was integrated with 1.3.0 (Except
>>> removing FileExchange). I don't know if the file handling is correct,
>>> but
>>> my problem is that I don't even get to that code. process() never gets
>>> called when files are dropped in. Is there something new I need to do?
>>> Thanks.
>>>
>>
>> This code
>>> File file = (File)e.getIn();
>>
>> Should be
>> File file = e.getIn().getBody(File.class);
>>
>> What does the string "dir" contain?
>>
>> You can always try to simplify by doing
>> from("file://" + dir).to("log:foo");
>>
>> And have logging at INFO level.
>> To see if the files is picked up.
>>
>>
>>
>>>
>>> from("file://"+dir).errorHandler(deadLetterChannel("bean:DeadLetterChannelProcessor/handleError").maximumRedeliveries(1)).process(new
>>> Processor() {
>>> public void process(Exchange e) {
>>> logger.error("Exchanged called!!!");
>>> try {
>>> File file = (File)e.getIn();
>>> logger.debug("Filename: " + file.toString());
>>> long start = System.currentTimeMillis();
>>> FileInputStream fis = new FileInputStream(file);
>>> handle(fis, file);
>>> fis.close();
>>> long end = System.currentTimeMillis();
>>> logger.info(String.format( "Runtime %1$d ms (%2$d to
>>> %3$d)",(end -
>>> start), start, end));
>>> } catch (Exception ex) {
>>> ex.printStackTrace();
>>> }
>>> }
>>> });
>>>
>>>
>>>
>>>
>>>
>>>
>>> Claus Ibsen-2 wrote:
>>>>
>>>> On Fri, Oct 9, 2009 at 4:55 PM, sub3 <st...@subwest.com> wrote:
>>>>>
>>>>> I am trying to upgrade my system from 1.3.0 to 2.0.0. I can't seem to
>>>>> find
>>>>> org.apache.camel.component.file.FileExchange.
>>>>>
>>>>> When I look at the javadocs online, it is there, but I can't find it in
>>>>> any
>>>>> of the jars. Do I need to compile it myself, or am I just overlooking
>>>>> something?
>>>>>
>>>>
>>>> The javadocs online is outdated. The apache infrastructure is playing
>>>> tricks on us so we cant always update it when we do new releases.
>>>>
>>>> In Camel 2.0 there is only a single Exchange now =
>>>> org.apache.camel.impl.DefaultExchange.
>>>> There are no more specialized exchanges.
>>>>
>>>>
>>>>
>>>>> Thanks for your help.
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/Upgrading-to-2.0---Using-FileExchange-tp25822604p25822604.html
>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Claus Ibsen
>>>> Apache Camel Committer
>>>>
>>>> Open Source Integration: http://fusesource.com
>>>> Blog: http://davsclaus.blogspot.com/
>>>> Twitter: http://twitter.com/davsclaus
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Upgrading-to-2.0---Using-FileExchange-tp25822604p25856153.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Upgrading-to-2.0---Using-FileExchange-tp25822604p25865126.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
--
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Re: Upgrading to 2.0 - Using FileExchange
Posted by sub3 <st...@subwest.com>.
Thanks, that helped. I also forgot the context.start() too, which caused the
last problem.
If you don't mind, I have one follow up question:
In Camel 1.3.0, when I used 'from("file://directory?delete=true")' and I
shutdown the system before finishing the file, I was left with a
file.txt.camelLock in that directory.
On startup, the system would still read that file (I guess it knew the file
wasn't really locked). In 2.0.0, it doesn't read this file, it waits for me
to delete this file.
Is there anyway to force Camel to re-read this file, or do I just have an
external process delete this lock file before I startup?
Thanks.
Claus Ibsen-2 wrote:
>
> On Mon, Oct 12, 2009 at 3:50 PM, sub3 <st...@subwest.com> wrote:
>>
>> Thanks. That got me past the compilation errors, but I am not able to
>> get it
>> to trigger in 2.0.
>>
>> Below is the same code from when I was integrated with 1.3.0 (Except
>> removing FileExchange). I don't know if the file handling is correct,
>> but
>> my problem is that I don't even get to that code. process() never gets
>> called when files are dropped in. Is there something new I need to do?
>> Thanks.
>>
>
> This code
>> File file = (File)e.getIn();
>
> Should be
> File file = e.getIn().getBody(File.class);
>
> What does the string "dir" contain?
>
> You can always try to simplify by doing
> from("file://" + dir).to("log:foo");
>
> And have logging at INFO level.
> To see if the files is picked up.
>
>
>
>>
>> from("file://"+dir).errorHandler(deadLetterChannel("bean:DeadLetterChannelProcessor/handleError").maximumRedeliveries(1)).process(new
>> Processor() {
>> public void process(Exchange e) {
>> logger.error("Exchanged called!!!");
>> try {
>> File file = (File)e.getIn();
>> logger.debug("Filename: " + file.toString());
>> long start = System.currentTimeMillis();
>> FileInputStream fis = new FileInputStream(file);
>> handle(fis, file);
>> fis.close();
>> long end = System.currentTimeMillis();
>> logger.info(String.format( "Runtime %1$d ms (%2$d to
>> %3$d)",(end -
>> start), start, end));
>> } catch (Exception ex) {
>> ex.printStackTrace();
>> }
>> }
>> });
>>
>>
>>
>>
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> On Fri, Oct 9, 2009 at 4:55 PM, sub3 <st...@subwest.com> wrote:
>>>>
>>>> I am trying to upgrade my system from 1.3.0 to 2.0.0. I can't seem to
>>>> find
>>>> org.apache.camel.component.file.FileExchange.
>>>>
>>>> When I look at the javadocs online, it is there, but I can't find it in
>>>> any
>>>> of the jars. Do I need to compile it myself, or am I just overlooking
>>>> something?
>>>>
>>>
>>> The javadocs online is outdated. The apache infrastructure is playing
>>> tricks on us so we cant always update it when we do new releases.
>>>
>>> In Camel 2.0 there is only a single Exchange now =
>>> org.apache.camel.impl.DefaultExchange.
>>> There are no more specialized exchanges.
>>>
>>>
>>>
>>>> Thanks for your help.
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Upgrading-to-2.0---Using-FileExchange-tp25822604p25822604.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Upgrading-to-2.0---Using-FileExchange-tp25822604p25856153.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>
>
--
View this message in context: http://www.nabble.com/Upgrading-to-2.0---Using-FileExchange-tp25822604p25865126.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Upgrading to 2.0 - Using FileExchange
Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Oct 12, 2009 at 3:50 PM, sub3 <st...@subwest.com> wrote:
>
> Thanks. That got me past the compilation errors, but I am not able to get it
> to trigger in 2.0.
>
> Below is the same code from when I was integrated with 1.3.0 (Except
> removing FileExchange). I don't know if the file handling is correct, but
> my problem is that I don't even get to that code. process() never gets
> called when files are dropped in. Is there something new I need to do?
> Thanks.
>
This code
> File file = (File)e.getIn();
Should be
File file = e.getIn().getBody(File.class);
What does the string "dir" contain?
You can always try to simplify by doing
from("file://" + dir).to("log:foo");
And have logging at INFO level.
To see if the files is picked up.
>
> from("file://"+dir).errorHandler(deadLetterChannel("bean:DeadLetterChannelProcessor/handleError").maximumRedeliveries(1)).process(new
> Processor() {
> public void process(Exchange e) {
> logger.error("Exchanged called!!!");
> try {
> File file = (File)e.getIn();
> logger.debug("Filename: " + file.toString());
> long start = System.currentTimeMillis();
> FileInputStream fis = new FileInputStream(file);
> handle(fis, file);
> fis.close();
> long end = System.currentTimeMillis();
> logger.info(String.format( "Runtime %1$d ms (%2$d to %3$d)",(end -
> start), start, end));
> } catch (Exception ex) {
> ex.printStackTrace();
> }
> }
> });
>
>
>
>
>
>
> Claus Ibsen-2 wrote:
>>
>> On Fri, Oct 9, 2009 at 4:55 PM, sub3 <st...@subwest.com> wrote:
>>>
>>> I am trying to upgrade my system from 1.3.0 to 2.0.0. I can't seem to
>>> find
>>> org.apache.camel.component.file.FileExchange.
>>>
>>> When I look at the javadocs online, it is there, but I can't find it in
>>> any
>>> of the jars. Do I need to compile it myself, or am I just overlooking
>>> something?
>>>
>>
>> The javadocs online is outdated. The apache infrastructure is playing
>> tricks on us so we cant always update it when we do new releases.
>>
>> In Camel 2.0 there is only a single Exchange now =
>> org.apache.camel.impl.DefaultExchange.
>> There are no more specialized exchanges.
>>
>>
>>
>>> Thanks for your help.
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Upgrading-to-2.0---Using-FileExchange-tp25822604p25822604.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Upgrading-to-2.0---Using-FileExchange-tp25822604p25856153.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
--
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Re: Upgrading to 2.0 - Using FileExchange
Posted by sub3 <st...@subwest.com>.
Thanks. That got me past the compilation errors, but I am not able to get it
to trigger in 2.0.
Below is the same code from when I was integrated with 1.3.0 (Except
removing FileExchange). I don't know if the file handling is correct, but
my problem is that I don't even get to that code. process() never gets
called when files are dropped in. Is there something new I need to do?
Thanks.
from("file://"+dir).errorHandler(deadLetterChannel("bean:DeadLetterChannelProcessor/handleError").maximumRedeliveries(1)).process(new
Processor() {
public void process(Exchange e) {
logger.error("Exchanged called!!!");
try {
File file = (File)e.getIn();
logger.debug("Filename: " + file.toString());
long start = System.currentTimeMillis();
FileInputStream fis = new FileInputStream(file);
handle(fis, file);
fis.close();
long end = System.currentTimeMillis();
logger.info(String.format( "Runtime %1$d ms (%2$d to %3$d)",(end -
start), start, end));
} catch (Exception ex) {
ex.printStackTrace();
}
}
});
Claus Ibsen-2 wrote:
>
> On Fri, Oct 9, 2009 at 4:55 PM, sub3 <st...@subwest.com> wrote:
>>
>> I am trying to upgrade my system from 1.3.0 to 2.0.0. I can't seem to
>> find
>> org.apache.camel.component.file.FileExchange.
>>
>> When I look at the javadocs online, it is there, but I can't find it in
>> any
>> of the jars. Do I need to compile it myself, or am I just overlooking
>> something?
>>
>
> The javadocs online is outdated. The apache infrastructure is playing
> tricks on us so we cant always update it when we do new releases.
>
> In Camel 2.0 there is only a single Exchange now =
> org.apache.camel.impl.DefaultExchange.
> There are no more specialized exchanges.
>
>
>
>> Thanks for your help.
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Upgrading-to-2.0---Using-FileExchange-tp25822604p25822604.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>
>
--
View this message in context: http://www.nabble.com/Upgrading-to-2.0---Using-FileExchange-tp25822604p25856153.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Upgrading to 2.0 - Using FileExchange
Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Oct 9, 2009 at 4:55 PM, sub3 <st...@subwest.com> wrote:
>
> I am trying to upgrade my system from 1.3.0 to 2.0.0. I can't seem to find
> org.apache.camel.component.file.FileExchange.
>
> When I look at the javadocs online, it is there, but I can't find it in any
> of the jars. Do I need to compile it myself, or am I just overlooking
> something?
>
The javadocs online is outdated. The apache infrastructure is playing
tricks on us so we cant always update it when we do new releases.
In Camel 2.0 there is only a single Exchange now =
org.apache.camel.impl.DefaultExchange.
There are no more specialized exchanges.
> Thanks for your help.
>
> --
> View this message in context: http://www.nabble.com/Upgrading-to-2.0---Using-FileExchange-tp25822604p25822604.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
--
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus