服务总线 - 我是傻子吗?

发布于 2024-12-01 14:21:53 字数 680 浏览 2 评论 0原文

我已经研究公共交通几个月了,我对它的可能性非常感兴趣。但是,我似乎无法完全正确地理解这些概念。我查看了代码,也浏览了文档,但我只是觉得我没有理解它。

一般情况下的示例表明;

    Bus.Initialize( sbc =>
                       {
                           sbc.UseMsmq( );
                           sbc.VerifyMsmqConfiguration( );
                           sbc.UseMulticastSubscriptionClient( );
                           sbc.ReceiveFrom( "msmq://localhost/myqueue" );
                       } );

现在,我明白这是在做什么,但我不明白我认为我的大脑对这个概念的理解比这更进一步:

  • 消息,并在服务总线内订阅在收到该消息后执行的操作,
  • 可以从软件发布 位于消息队列的顶部(或者RabbitMQ 或 MT 中的 MSMQ)

我只是想更多地了解这一点,我认为我没有明白。我需要配置一个服务器来监听吗?我是否在我的软件中进行设置,然后发布消息,然后从内部获取并处理它们?

I've been looking at Mass Transit for a couple of months now, and I'm really intrigued by the possibilities. However, I don't seem to be able to get the concepts quite right. I've looked the code, and I've gone through the documentation, but I just don't feel that I"m understanding it.

The examples in general show;

    Bus.Initialize( sbc =>
                       {
                           sbc.UseMsmq( );
                           sbc.VerifyMsmqConfiguration( );
                           sbc.UseMulticastSubscriptionClient( );
                           sbc.ReceiveFrom( "msmq://localhost/myqueue" );
                       } );

Now, I understand what this is doing, but I don't think my brain is taking the concept further than this. Here's what I do understand;

  • Messages can be published from the software, and subscribed to within the service bus for action/s to be performed on receipt of that message.
  • The Service Bus itself, sits on top of a messaging queue (either RabbitMQ or MSMQ in MT)

I just want to understand a little more about this. I don't think I"m getting it. Do I need a server configured, listening? Do I set it up in my software then just publish messages, they get picked up and processed from within?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

绿萝 2024-12-08 14:21:53

首先,开始使用 MassTransit...

这个想法是让多个系统进行通信。现在这只是消息传递,并不真正需要大众交通。 AB 对话。当我们开始谈论 pub/sub 时,它会变得更有趣。 A 发布 B 正在侦听的消息 CreateOrder。当B收到CreateOrder消息时,它可以采取处理新订单所需的任何步骤。这使得服务解耦,唯一的交互点是一个非常简单的消息,CreateOrder

现在 pub/sub 的乐趣在于 AB 来回移动一段时间,而我们有 C 想要监听到 CreateOrder 消息中,以便它可以在 B 完成其所有任务之前准备发货库存。我们可以将 C 放入总线中,它订阅 CreateOrder 消息,并且 AB 都不需要更改任何代码。这可以在他们主动来回发送消息时完成。您需要升级其中一名成员吗?只需停止该服务,放入新服务,然后重新启动它,允许它从停止的地方选择它即可。

如果您对这个主题有更多疑问,我会尝试访问邮件列表。我相信我们会尽可能地做出反应。此外,您还可以找到一些相关的问题和书籍...

《企业集成模式》是一本很棒的书,尽管它更多地是考虑到 Java 来编写的。

First off, getting start with MassTransit...

The idea is that you have multiple systems communicating. Now that's just messaging and doesn't really require MassTransit. A talks to B. When we start talking about pub/sub it can become more interesting. A publishes msg CreateOrder which B is listening for. When B receives that CreateOrder message it can take whatever steps is required to handle a new order. This leaves the services decoupled, the only interaction point is a pretty simple message, the CreateOrder.

Now the joy of pub/sub is that A and B are going back and forth for a while, and we have C that wants to listen into CreateOrder messages so it can prepare stock for shipping before B completes all its tasks. We can drop C into the bus, it subscribes to the CreateOrder message and neither A nor B need to change any code. This can be done while they are actively sending messages back and forth. You need to upgrade one of the members involved? Just stop that service, drop in the new one, and restart it, allowing it to pick it where it left off.

If you have more questions on this topic, I'd try hitting up the mailing list. I'd like to believe we are rather responsive when we can be. Additionally you can hit up a couple related questions and books ...

Enterprise Integration Patterns is a great book, even if was written more with Java in mind.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文