0

Let's say there is service bus instance working in one way mode. The service bus generates two kinds of messages: Foo and Bar. Both of these message types are to be saved in database.

So I can see two approaches for doing so:

  1. Have two queues (FooQueue, BarQueue) and two bus instances (two processes) - one for receiving from FooQueue and one for receiving from BarQueue

  2. Have one queue and one bus instance with two handlers for Foo and Bar messages

I would like to ask what are best practises (maybe even decision tree? :) ) for deciding when to use which approach.

Thanks in advance

4

1 回答 1

1

嗯....在您的情况下,这听起来很像周围的基础设施(即数据库连接字符串、数据层 API)以及问题域(“将消息保存到数据库”)在两种消息类型之间共享 - 它听起来它们不会被以不同的方式处理 - 对我来说,这听起来像是有一个单一的端点来接收和保存消息是很有意义的。

事实上,IHandleMessages<object>如果您知道端点只能接收必须保存的消息,则可以使用实现的单个处理程序。

于 2014-09-17T15:10:07.500 回答