NServicebus-一个端点多个处理程序线程 [英] NServicebus - One endpoint multiple handlers threading

查看:59
本文介绍了NServicebus-一个端点多个处理程序线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个端点.

端点1:

  • HandlerForMessage X
  • HandlerForMessage Y
  • HandlerForMessage Z

Web端点: -目前没有处理程序,仅向总线发送命令.

Web endpoint: - No handlers at this time, just sends commands to the bus.

发生以下情况:

  1. Web->发送< MessageX>(..);
  2. 端点1:接收MessageX
  3. 端点1:处理MessageX并在处理程序总线中处理. MessageY>()和Bus.Send< MessageZ>()
  4. 端点1:接收MessageY,对其进行处理(这需要20秒)
  5. 端点1:20秒钟后,在处理MessageY之后,接收并处理MessageZ.

由于MessageY,MessageZ具有不同的处理程序,因此不能同时完成吗?

Since MessageY, MessageZ have different Handlers can't this be done simultaniously?

创建另一个端点或将其移动到另一个端点不是一种选择.我只希望它在涉及不同类型的消息(和处理程序)时是多线程的.我不明白为什么这不是默认行为.

Creating another endpoint or moving it to an other endpoint is not an option. I just want it to be multithreaded when it comes to different types of messages (and handlers). I don't see why this is not the default behavior.

如何配置nservicebus以同时处理来自不同类型(具有不同处理程序)的多个消息?

How do I configure nservicebus to handle multiple messages at the same time from a different type (with different handler)?

NServiceBus 4.6.5(或者如果我需要升级到5,可以,我不介意.只想让它多线程). 传输:SqlServer和用于另一个项目的Windows Azure Service Bus

NServiceBus 4.6.5 (or if I need to upgrade to 5, fine I don't mind. Just want to have it multithreaded). Transport: SqlServer and for another project Windows Azure Service Bus

推荐答案

除非自从我开始使用NServiceBus以来它没有更改,否则"unlicenced"版本仅运行1个工作线程,因此一次只能处理1条消息.

Unless it has changed since I started using NServiceBus, the "unlicenced" version only runs 1 worker thread so it only processes 1 message at a time.

您可以通过更改传输中的NumberOfWorkerThreads值在配置中进行更改,但是您需要有效的许可证才能将数量增加到1以上.

You can alter this in the config by altering the NumberOfWorkerThreads value on the transport, however you need a valid licence in order to increase the number above 1.

<MsmqTransportConfig MaxRetries="0" NumberOfWorkerThreads="1" />

在NServiceBus v4中,您需要在TransportConfig上配置MaximumConcurrencyLevel值:

In NServiceBus v4, you need to configure the MaximumConcurrencyLevel value on the TransportConfig:

<TransportConfig MaximumConcurrencyLevel="5" 
                 MaxRetries="2" 
                 MaximumMessageThroughputPerSecond="0"/>

请参见故障处理和维护;节流

这篇关于NServicebus-一个端点多个处理程序线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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