You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "robbenpeng@foxmail.com" <ro...@foxmail.com> on 2021/10/25 06:07:47 UTC
How Camel consumes files using multithreading
Dear all,
I am using Apache Camel to handle files from SFTP. Becausethere are too many file in the same directoty, I want to use multithreading to handle these files.
Hera is my code.
from("sftp://${sftp.username}:${sftp.password}@${sftp.host}:${sftp.port}/myDirectory?" +
"readLock=changed&readLockMinAge=10s&autoCreate=true&move=finish/$simple{date:now:yyyyMMdd}/$simple{file:onlyname}" +
"&moveFailed=failed/$simple{date:now:yyyyMMdd}/$simple{file:onlyname}")
.to("seda:img");
from("seda:img")
.threads(5,20)
.keepAliveTime(20)
.process(parseTypeProcessor)
.process(uploadToOSSProcessor)
.process(saveImgProcessor)
.end();
But it does not work.
Is there any way to use multithreading in Apache Camel?
Any help or information that you can provide will be greatly appreciated.
Sincerely,
Robben
robbenpeng@foxmail.com
Re: How Camel consumes files using multithreading
Posted by Francois Papon <fr...@openobject.fr>.
Hi,
Did you try to add .threads() to your from("sftp") route?
regards,
Francois
On 25/10/2021 08:07, robbenpeng@foxmail.com wrote:
> Dear all,
> I am using Apache Camel to handle files from SFTP. Becausethere are too many file in the same directoty, I want to use multithreading to handle these files.
>
> Hera is my code.
> from("sftp://${sftp.username}:${sftp.password}@${sftp.host}:${sftp.port}/myDirectory?" +
> "readLock=changed&readLockMinAge=10s&autoCreate=true&move=finish/$simple{date:now:yyyyMMdd}/$simple{file:onlyname}" +
> "&moveFailed=failed/$simple{date:now:yyyyMMdd}/$simple{file:onlyname}")
> .to("seda:img");
>
> from("seda:img")
> .threads(5,20)
> .keepAliveTime(20)
> .process(parseTypeProcessor)
> .process(uploadToOSSProcessor)
> .process(saveImgProcessor)
> .end();
> But it does not work.
>
> Is there any way to use multithreading in Apache Camel?
>
> Any help or information that you can provide will be greatly appreciated.
>
> Sincerely,
> Robben
>
>
> robbenpeng@foxmail.com