Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asynchronous 何时使用驼峰窃听器或SEDA?_Asynchronous_Apache Camel - Fatal编程技术网

Asynchronous 何时使用驼峰窃听器或SEDA?

Asynchronous 何时使用驼峰窃听器或SEDA?,asynchronous,apache-camel,Asynchronous,Apache Camel,在我的驼峰路径中,当异常击中我的onException处理程序时,我需要向JMS发送消息。为了加快主路由的速度,我尝试通过 我试着用这样的方法: onException().handled(true).logHandled(true) .wiretap("seda:another_queue").end(); ... from("seda:another_queue?concurrentConsumers=5") .to("jms:queue_for_my_exception_messa

在我的驼峰路径中,当异常击中我的
onException
处理程序时,我需要向JMS发送消息。为了加快主路由的速度,我尝试通过

我试着用这样的方法:

onException().handled(true).logHandled(true)
  .wiretap("seda:another_queue").end();
...
from("seda:another_queue?concurrentConsumers=5")
  .to("jms:queue_for_my_exception_messages");
onException().handled(true).logHandled(true)
  .to("seda:another_queue").end();
...
from("seda:another_queue?concurrentConsumers=5")
  .to("jms:queue_for_my_exception_messages");
是否有必要使用,或者我是否可以使用以下队列:

onException().handled(true).logHandled(true)
  .wiretap("seda:another_queue").end();
...
from("seda:another_queue?concurrentConsumers=5")
  .to("jms:queue_for_my_exception_messages");
onException().handled(true).logHandled(true)
  .to("seda:another_queue").end();
...
from("seda:another_queue?concurrentConsumers=5")
  .to("jms:queue_for_my_exception_messages");

您不需要使用wiretap。只有seda队列才能工作


当您希望拦截组件之间的消息以进行分析或调试时,应使用该模式。

Wiretap和SEDA之间的一个重要区别是,当从轮询消费者(例如或)处消费时,只有Wiretap是fire and forget


当使用轮询使用者的线程到达
.to(seda:xx)
时,它将放弃交换并按预期继续路由,或者使用来自终结点的新交换。传递到seda端点的交换将由seda线程而不是原始使用者线程提交给原始使用者。这意味着,例如,如果您在轮询消费者端点定义中具有
delete=true
,则在seda线程完成之前,不会删除该文件。

EIP页面讨论了我的确切用例,我希望将该消息用于监视目的。我的问题更多的是在技术方面:是否有必要使用WireTap将信息传送到第二个通道,并且对主要路线上的执行影响最小?还是SEDA也一样快?我认为我必须对这两种变体进行更多的负载测试。是的,您应该使用替代通道,以将对主要路线的影响降至最低。或者,探索使用JMS队列或将消息持久化到文件系统而不是使用seda的选项。因为前者应确保消息是持久的。