使用 apache camel 处理多个文件
Process multiple files using apache camel
我想使用 apache camel 处理多个文件,尝试使用 .thread 方法但没有按预期工作。
.thread(3) 将选择多个文件并进行处理,但如果线程 1 首先处理,则它不会立即处理文件 4,而是等待所有线程(剩余 2 个线程)完成处理
更新:
from("file:filepath?maxMessagesPerPoll=1&delete=true&readLockMinLength=0")
.routeId("gateway.msg2file.cnqm1")
.threads(3,3)
.process(myProcessor)
.choice()
.when(header("Result").isEqualTo(true))
.to("path") .otherwise()
.to("file://xxx")
.setBody( simple("test"))
.setHeader("sss"))
.to("velocity:testmail.vm")
.to("smtp://test@mail.com"+ "&contentType=" + "text/html");
from("file:filepath?maxMessagesPerPoll=1&delete=true&readLockMinLength=0")
.to("seda:input");
from("seda:input?concurrentConsumers=3")
.process(myProcessor)
.choice()
.when(header("Result").isEqualTo(true))
.to("path") .otherwise()
.to("file://xxx")
.setBody( simple("test"))
.setHeader("sss"))
.to("velocity:testmail.vm")
.to("smtp://test@mail.com"+ "&contentType=" + "text/html");
我想使用 apache camel 处理多个文件,尝试使用 .thread 方法但没有按预期工作。
.thread(3) 将选择多个文件并进行处理,但如果线程 1 首先处理,则它不会立即处理文件 4,而是等待所有线程(剩余 2 个线程)完成处理
更新:
from("file:filepath?maxMessagesPerPoll=1&delete=true&readLockMinLength=0")
.routeId("gateway.msg2file.cnqm1")
.threads(3,3)
.process(myProcessor)
.choice()
.when(header("Result").isEqualTo(true))
.to("path") .otherwise()
.to("file://xxx")
.setBody( simple("test"))
.setHeader("sss"))
.to("velocity:testmail.vm")
.to("smtp://test@mail.com"+ "&contentType=" + "text/html");
from("file:filepath?maxMessagesPerPoll=1&delete=true&readLockMinLength=0")
.to("seda:input");
from("seda:input?concurrentConsumers=3")
.process(myProcessor)
.choice()
.when(header("Result").isEqualTo(true))
.to("path") .otherwise()
.to("file://xxx")
.setBody( simple("test"))
.setHeader("sss"))
.to("velocity:testmail.vm")
.to("smtp://test@mail.com"+ "&contentType=" + "text/html");