骆驼分路器并行处理 [英] camel splitter parallel processing

查看:280
本文介绍了骆驼分路器并行处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个服务调用返回与我们调用另一个服务,在同一时间只接受一个I​​D标识的列表,所以我们使用的是转向并行处理真正的<骆驼分路器/ code>。现在,我们为服务呼叫是通过SEDA,所以我们可以把超时就可以了。这将导致问题,即由于镇静默认仅具有1个并发的消费者在其上工作的并行处理将不会被平行了。

We have a service call which returns a list of ids with which we call another service which takes only one id at a time, so we are using the camel splitter with parallel processing turned to true. Now the call we make for the service is through a seda so we can put a timeout on it. This will cause the problem that parallel processing will not be parallel anymore since seda by default has only 1 concurrent consumers working on it.

选项:


  1. 放?concurrentConsumers = X的SEDA

  2. 使用直接的,而不是SEDA。 (无超时选项?)

  3. 任何其他的选择吗?

1和2其中之一将是preferable

Of 1 and 2 which one would be preferable?

推荐答案

首先设置分流到真正上分器是大消息非常有用。这意味着它将在块分割的输入消息。这减少了存储器的开销。因此,这将改善大消息性能。

Firstly setting streaming to true on the splitter is useful for big messages. Which means it will split the input message in chunks. This reduces the memory overhead. So this will improve performance with large messages.

对于 SEDA 队列真正的并行过程中,你需要设置 SEDA 路线如下:

For a seda queue to truly process in parallel you need to set the seda route as follows.

<from uri="seda:report?multipleConsumers=true&amp;concurrentConsumers=16"/>

这将使该航线使用多达16个线程并发的消费者。在 SEDA 组件没有实现任何类型的持久性或恢复的,如果虚拟机而终止的消息尚未被处理,他们将丢失。如果您需要持久性,可靠性或分布式 SEDA ,请尝试使用或者 JMS 的ActiveMQ

This will allow the route to use up to 16 threads for concurrent consumers. The seda component does not implement any kind of persistence or recovery, if the VM terminates while messages are yet to be processed they will be lost. If you need persistence, reliability or distributed seda, try using either jms or activemq

直接组件是同步的,根据文档支持多消费者去precated。由于骆驼2.1:直接终端不支持多消费者

The direct component is synchronous and according to the documentation support for multiple consumers are deprecated. As of Camel 2.1: Direct endpoint does not support multiple consumers.

另一种选择是 VM 组件。在 VM 组件在该 SEDA 组件不同, VM 支持通信横渡 CamelContext 实例 - 所以你可以使用这种机制在Web应用程序本质上 VM 组件是一个扩展交流在 SEDA 部分。

The other option is the vm component. The vm 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 Essentially the vm component is an extension to the seda component.

所以,如果如果你需要并行处理的直接组件是没有用的。如果您需要跨 CamelContent 实例发送消息,然后用 VM 如果没有的话用 SEDA 如上所述。

So if if you need parallel processing the direct component is not useful. If you need to send message across CamelContent instances then use vm if not then use seda as described above.

这篇关于骆驼分路器并行处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆