The seda: component provides asynchronous SEDA behavior, so that messages are exchanged on a BlockingQueue and consumers are invoked in a separate thread from the producer.
Note that queues are only visible within a single CamelContext. If you want to communicate across CamelContext
instances (for example, communicating between Web applications), see the VM component.
This component does not implement any kind of persistence or recovery, if the VM terminates while messages are yet to be processed. If you need persistence, reliability or distributed SEDA, try using either JMS orActiveMQ.
总结:Seda是异步并且不跨CamelContent的,不继支持任何的持久化和恢复机制,失败之后没有处理的消息不会再处理,如果需要持久化、消息可靠或者达到分布式,那么我们可以考虑用JMS(jvm消息服务)和MQ。
eg:<route><from uri="seda:_targeUri"/><to uri="seda:_targeUri"/></route>
The vm: component provides asynchronous SEDA behavior, exchanging messages on a BlockingQueue and invoking consumers in a separate thread pool.
This component differs from the Seda component in that VM supports communication across CamelContext instances - so you can use this mechanism to communicate across web applications (provided that camel-core.jar
is on the system/boot
classpath).
VM is an extension to the Seda component.
The direct-vm: component provides direct, synchronous invocation of any consumers in the JVM when a producer sends a message exchange.
This endpoint can be used to connect existing routes in the same camel context, as well from other camel contexts in the same JVM.
This component differs from the Direct component in that Direct-VM supports communication across CamelContext instances - so you can use this mechanism to communicate across web applications (provided that camel-core.jar is on the system/boot classpath).