Camel-Component组件总结

了解OSGI领域的都知道,osgi的路由很强大,然而在路由的背后,有几个组件是非常重要的。


S1.SEDA Component


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>


V2.VM Component


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.jaris on the system/boot classpath).

VM is an extension to the Seda component.


总结: Vm异步并且 跨CamelContent的,是Seda的扩展。
eg:<route><from uri="vm:_targeUri"/><to uri="vm:_targeUri"/></route>

   3.Direct Component


The direct: component provides direct, synchronous invocation of any consumers when a producer sends a message exchange.
This endpoint can be used to connect existing routes in the same camel context.

总结:Direct同步并且不跨CamelContent的。
eg:<route><from uri="direct:_targeUri"/><to uri="direct:_targeUri"/></route>

44.Direct VM 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).


总结: direct-vm 同步 并且 跨CamelContent 的,是Direct的扩展。
eg:<route><from uri="direct-vm:_targeUri"/><to uri="direct-vm:_targeUri"/></route>

你可能感兴趣的:(Camel-Component组件总结)