从 Web 应用程序 (NServiceBus v3.2.0.0) 使用 Bus.Send(非发布) [英] Use Bus.Send (not Publish) from web applications (NServiceBus v3.2.0.0)

查看:46
本文介绍了从 Web 应用程序 (NServiceBus v3.2.0.0) 使用 Bus.Send(非发布)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个 asp.net mvc3 应用程序,它发布许多事件.最近,有人指出我们应该发送消息而不是从 Web 应用程序发布事件,并引用了这个 优秀的博客文章,这很有意义.但是,我想确认帖子中的观点对 NServiceBus v3.x 仍然有效吗?

We have an asp.net mvc3 application which publishes a number of events. Recently, someone pointed out that we should be sending messages rather than publishing events from the web application and referenced this excellent blog post which makes perfect sense. However, I want to confirm that the points made in the post are still valid for NServiceBus v3.x?

谢谢!

推荐答案

我认为无论 NServiceBus 版本如何,帖子背后的推理都将始终成立.

I would imagine that the reasoning behind the post would always hold true, irrespective of the version of NServiceBus.

话虽如此,没有什么能阻止您从网站发布消息.发布消息背后的想法是,消息代表一个通常由某些处理端点产生的事件.由于 Web 应用程序不应该真正处理任何事情,而应该将命令发送到处理端点,因此 Web 应用程序不应该发布事件是理所当然的.

That being said, there is nothing stopping you from publishing a message from a web-site. The idea behind publishing a message is that the message represents an event that is typically produced by some processing endpoint. Since a web application should not really be processing anything but rather be sending commands off to a processing endpoint it would stand to reason that a web application should not be publishing events.

因此,如果您发现自己处于从 Web 应用程序发布似乎有意义的情况,则表明您需要做出设计决策:设计不是最佳的(因此 Web 应用程序正在执行处理)或者您在某些方面受到限制,禁止实现处理端点(可能是共享托管环境).

So if you find yourself in a situation where it seems to make sense to publish from your web application it indicates that you need to make a design decision: either the design is not optimal (so the web application is performing processing) or you are constrained in some way the prohibits the implementation of a processing endpoint (maybe a shared hosting environment).

这篇关于从 Web 应用程序 (NServiceBus v3.2.0.0) 使用 Bus.Send(非发布)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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