...
The seda: component provides asynchronous SEDA behavior so that messages are exchanged on a BlockingQueue and consumers are invoked in a separate thread to the producer.
Warning | ||||
---|---|---|---|---|
| ||||
Be aware that adding a thread pool to a seda endpoint by doing something like:
can wind up with two BlockQueues. One from seda endpoint and one from the workqueue of the thread pool which may not be what you want. Instead, you might want to consider configuring a Direct endpoint with a thread pool which can process messages both synchronously and asynchronously. For example:
|
Note that queues are only visible within a single CamelContext. If you want to communicate across CamelContext instances such as to communicate across web applications, see the VM component.
...
Name | Default | Description |
---|---|---|
size | 1000 | The maximum size of the SEDA queue |
Thread pools
Be aware that adding a thread pool to a seda endpoint by doing something like:
Code Block |
---|
from("seda:stageName").thread(5).process(...)
|
can wind up with two BlockQueues. One from seda endpoint and one from the workqueue of the thread pool which may not be what you want. Instead, you might want to consider configuring a Direct endpoint with a thread pool which can process messages both synchronously and asynchronously. For example:
Code Block |
---|
from("direct:stageName").thread(5).process(...)
|
Sample
In the route below we use the SEDA queue to send the request to this async queue to be able to send a fire-and-forget message for further processing in another thread, and return a constant reply in this thread to the original caller.
...