Below testing code doesn't work
from("direct:start").setExchangePattern(ExchangePattern.InOnly).threads(5).delay(2000).bean(MessageHeaderValidator.class);
Although seda is the alternative, referring to Camel seda document . It is recommended to use the direct endpoint instead.
Thread pools
Be aware that adding a thread pool to a SEDA endpoint by doing something like:
from("seda:stageName").thread(5).process(...)
Can wind up with two BlockQueues: one from the SEDA endpoint, and one from the workqueue of the thread pool, which may not be what you want.Instead, you might wish to configure a Direct endpoint with a thread pool, which can process messages both synchronously and asynchronously. For example:
from("direct:stageName").thread(5).process(...)
You can also directly configure number of threads that process messages on a SEDA endpoint using the concurrentConsumers option.
For parallel processing, use Camel's SEDA component with the concurrentConsumers
option:
from("seda:stageName?concurrentConsumers=5")
.process(...);
根本原因是,该消息正在for循环中被生产者模板阻塞逐一传递。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.