可以在IIS中托管NServiceBus发布者吗? [英] Safe to host NServiceBus publisher inside IIS?

查看:58
本文介绍了可以在IIS中托管NServiceBus发布者吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以安全地在IIS中托管充当事件发布者的NServiceBus终结点?

I was wondering if it's safe to host an NServiceBus endpoint that serves as an event publisher inside IIS?

为了澄清,我们使用IIS中托管的应用程序作为我们的宿主CRM系统(Microsoft Dynamics CRM),并且我想使用NServiceBus在联系人信息更新时发布事件。

MS CRM允许使用自定义插件对联系人更新做出反应,我打算创建一个插件,该插件通过NServiceBus针对这种情况发布 ContactUpdated事件。因此,这实际上将意味着我的NServiceBus事件发布终结点托管在IIS中。

To clarify, we use an application hosted in IIS as our CRM system (Microsoft Dynamics CRM), and I want to use NServiceBus to publish an event when a contact's information is updated.
MS CRM allows the use of custom plugins to react on a contact update, and I intend to create a plugin that publishes a 'ContactUpdated' event through NServiceBus for that situation. Hence, this will effectively mean that my NServiceBus event publishing endpoint is hosted in IIS.

现在,我知道一个自托管的NServiceBus终结点将创建自己的工作线程
来监视队列中的传入消息(在这种情况下为订阅消息)。由于IIS可以在没有更多传入Web请求的情况下自由卸载工作进程,因此通常使用IIS来托管长期运行的进程不是一个好主意。
但是,我想说NServiceBus队列监视线程没有资格作为长时间运行的进程,因为它不执行任何处理并且可以随时停止:新的订阅请求将然后
只需排队,直到再次重新启动Web应用程序。

Now, I know that a self-hosted NServiceBus endpoint will create its own worker thread to monitor incoming messages (in this case subscription messages) from the queue. Because IIS is free to unload a worker process if there are no more incoming web requests, it's usually not a good idea to use IIS to host long-running processes in. However, I'd say that the NServiceBus queue monitoring thread does not qualify as a long-running process because it doesn't do any processing and can be stopped at any time: new subscription requests will then simply be queued until the web application is restarted again.

我只是想从NServiceBus角度看IIS清理此NServiceBus线程的方法是否安全?

I'm just wondering if the way IIS cleans up this NServiceBus thread is safe, from an NServiceBus perspective?

(顺便说一句,我还发现这篇文章,但是我不得不承认,只有Scaling out的论点与我产生共鸣,而这与我们的情况无关。)

(Incidentally, I also found this article, but I have to admit that only the Scaling out argument resonates with me, and that is not relevant in our situation.)

推荐答案

是的,在IIS中托管NServiceBus发布终结点是安全的。

Yes, it is safe to host an NServiceBus publishing endpoint in IIS.

如您所说,如果IIS要卸载您的工作进程,然后所有未决的订阅请求将在队列中等待。这是合理的-只要您不对订阅请求的处理顺序和发布新事件的顺序做出任何假设。

As you said, if IIS were to unload your worker process then any pending subscription requests would be waiting in the queue. This is reasonable - as long as you don't make any assumptions about the order in which a subscription request would be handled and a new event published.

这篇关于可以在IIS中托管NServiceBus发布者吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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