Andrey
Andrey

Reputation: 21

Apache Camel .thread does not work

I've simple example:

from(FileSourceUri).threads(15)
  .doTry()
       .to(FileTargetUri)
       .to("direct:success")
  .doCatch(Exception.class)
       .to("direct:error");

FileSourceUri and FileTargetUri are local directories, direct:success and direct:error - endpoint from where I'll take log messages and send by MQ.

I want this route to process 15 files at the same time, but i can see in my folder that it takes them 1 by 1. What am I doing wrong?

Upvotes: 0

Views: 301

Answers (1)

Bilal ALP
Bilal ALP

Reputation: 146

You can use "scheduledExecutorService" property on file component. It takes a thread-pool and then consume multiple files as number of threads.

Here is the full documentation : http://camel.apache.org/file2.html

The important thing is what your camel version is. It has come in camel 2.10

Upvotes: 1

Related Questions