...
Name | Default | Description |
---|---|---|
| | The maximum size of the SEDA queue. |
| | Camel 1.6.1/2.0: Number of concurrent threads processing exchanges. |
| | Camel 2.0: Option to specify whether the caller should wait for the async task to complete or not before continuing. The following three options are supported: |
| | Camel 2.0: Timeout in millis a seda producer will at most waiting for an async task to complete. See |
| | Camel 2.2: Specifies whether multiple consumers is allowed or not. If enabled you can use SEDA for a pubsub kinda style messaging. Send a message to a seda queue and have multiple consumers receive a copy of the message. |
Changes in Camel 2.0
In Camel 2.0 the Seda component supports using Request Reply, where the caller will wait for the Async route to complete. For instance:
...
The "Hello World" message will be consumed from the SEDA queue from another thread for further processing. Since this is from a unit test, it will be sent to a mock
endpoint where we can do assertions in the unit test.
Using multipleConsumers
Available as of Camel 2.2
In this example we have defined two consumers and registered them as spring beans.
Wiki Markup |
---|
{snippet:id=e1|lang=xml|url=camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/example/fooEventRoute.xml} |
Since we have specified multipleConsumers=true on the seda foo endpoint we can have those two consumers receive their own copy of the message as a kind of pub-sub style messaging.
As the beans are part of an unit test they simply send the message to a mock endpoint, but notice how we can use @Consume to consume from the seda queue.
Wiki Markup |
---|
{snippet:id=e1|lang=java|url=camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/FooEventConsumer.java} |
Include Page | ||||
---|---|---|---|---|
|
...