Java – what is the difference between Seda, VM and direct? Use camel to explain it. Use an example

I worked with Seda and read documents directly with me Still can't imagine the use and directness of Seda VM is new to me Please explain it with an example

Solution

There are at least four different mechanisms. One camel route can directly transfer data to another "Direct" means not using the network or some form of intermediate storage (file, database) These mechanisms can be grouped according to whether they can transfer data between camelcontext instances and whether they are synchronous or asynchronous

>Direct – single camelcontext, synchronous (block generator) > Seda – single camelcontext, asynchronous (do not block producers) > VM – multiple camelcontexts, asynchronous (do not block producers) > Direct VM – multiple camelcontexts, synchronous (block generator)

Direct and direct VM mechanisms are synchronized because endpoint blocking is generated until the consuming endpoint and all the rest of its routing logic are completed Both Seda and VM mechanisms use the thread pool on the consumer, so that each request made by the producer is allocated to a thread in the pool This allows the consumer endpoint and its associated routing logic to act independently of the producer

In the case of communication between different camera contexts, both VM endpoints are required In many cases, routes can be combined into the same camelcontext However, it may sometimes be undesirable for modular or impossible reasons, as is the case with some application frameworks For example, I may implement some camel routing logic in the library (or component) in order to make the library used by other code For completeness, the library may define a self-contained camelcontext containing various routes If I want to call the camel logic in the library, I will need to use VM or direct VM, because the direct and Seda endpoints do not contain the logic required for routing between camel contexts

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>