6

几个月来我一直在关注公共交通,我对这些可能性非常感兴趣。但是,我似乎无法完全正确地理解这些概念。我查看了代码,也浏览了文档,但我只是不觉得我理解它。

一般的例子表明;

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

现在,我明白这是在做什么,但我认为我的大脑并没有比这更进一步。这就是我所理解的;

  • 消息可以从软件发布,并在服务总线中订阅,以便在收到该消息时执行操作。
  • 服务总线本身位于消息队列之上(MT 中的 RabbitMQ 或 MSMQ)

我只是想多了解一点。我认为我没有得到它。我需要配置一个服务器,监听吗?我是否在我的软件中设置它然后只是发布消息,它们被从内部拾取和处理?

4

1 回答 1

4

首先,开始使用 MassTransit...

这个想法是您有多个系统进行通信。现在这只是消息传递,并不需要 MassTransit。A交谈B。当我们开始谈论 pub/sub 时,它会变得更有趣。发布正在监听的Amsg 。当收到该消息时,它可以采取处理新订单所需的任何步骤。这使得服务分离,唯一的交互点是一个非常简单的消息,.CreateOrderBBCreateOrderCreateOrder

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.

于 2011-08-26T00:19:25.663 回答