Being new to Apache Camel, I was recently reviewing its long list of components and stumbled upon their support for SEDA queue components.
The page didn't make much sense to me, so I did a couple of online searches for the term "SEDA queue" and got the wikipedia article here.
After reading that article, I can't tell what the difference is between a SEDA queue and a normal, "ordinary" queue! Both embrace the notion of decoupling systems through the use of asynchronous queues.
From the article, "SEDA" just sounds like an architecture that consists of placing a queue between each component. Is this correct?
But if it's just an architecture, then why is a "SEDA" queue a special Apache Camel component?
SEDA is an acronym that stands for Staged Event Driven Architecture it is designed as a mechanism to regulate the flow between different phases of message processing. The idea is to smooth out the frequency of message output from an overall process so that it matches the input, It allows an enpoint´s consumer threads to offload the work of long-running operations into the background, thereby freeing them up to consume messages from the transport.
When an exchange is passed to a seda:
endpoint, it is placed into a BlockingQueue
. The list exists within the Camel context, wich means that only those routes that are within the same context can be joined by this type of endpoint. The queue is unbounded by default, although that can be changed by setting the size attribute on the URI of the consumer.
By default, a single thread assigned to the endpoint reads exchanges off the list and processes them through the route. As seen in the proceding example, it is possible to increase the number of concurrenctConsumers
to ensure that exchanges are getting processed from that list in a timely fashion.
The SEDA pattern is best suited to processing the InOnly
messages, where one route finishes processing and hands off to another to deal with the next phase. It is possible to ask for a response from seda:
endpoint by calling it when the message exchange pattern is InOut
.
Reference: Apache Camel Developer´s Cookbook