开发者

Scaled-out publication with scaled-out subscriber with NServiceBus

I am trying to de-couple two applications using EDA and NServiceBus. Currently, I have a Sales MT and an Inventory MT. Whenever a sale is requested through the Sales MT, before it is approved the Sales MT will call the Inventory MT to make sure there is available stock. I want to change the way this works, so that the Sales MT just automatically approves it, and publishes an async "SaleCreated" event, which the Inventory MT and the Billing MT will then subscribe to. The Inventory MT can then flag the Sale in an offline process if there are any out-of-stock items.

My problem is that I have 10 instances of my Sales MT, 5 instances of my Inventory MT, and 3 instances of my Billing MT. All 3 applications have their own Virtual IP on top of a LoadBalancer that sits in front of the 10/5/3 servers. So basically I have 1 virtual publication (SaleCreated events) and 2 virtual subscriptions (Inventory and Billing subscribers). Ideally, a Sale that gets processed by the Sales MT, should create a SaleCreated event message to be sent to 1 and only 1 Inventory MT, and 1 and only one Billing MT. I am really confused how this will work, since I haven't seen example开发者_如何学Gos of this scenario on the NServiceBus site. Also, I don't want to have all messages sent to a single distributor for each subscription, as that will cause one machine to be a bottleneck.

Is there any way to do this?


On the publishing side, you'd use the DB subscription storage option (found in the production profile) so that all publishing instances see the same list of subscribers. On the subscribing side, you'd use a distributor to distribute the load of events coming in so that each message is dispatch to only a single instance. Note that you'd use one distributor for each subscriber, so no real bottleneck, and the distributor doesn't do any actual work so it's not much of a concern.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜