Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已经开始研究 MassTransit 并正在编写将处理消息的类。当我实现接口时,我Consumes<T>得到四个选项:All、Selected和。这四个有什么区别,什么时候应该使用它们?For<T>Context
Consumes<T>
All
Selected
For<T>
Context
All只是给你所有的消息来消费。Context是所有,但Context<TMessage>如果你需要它,你也会得到它。Selected允许您在消息到达消费者之前接受或拒绝消息。For<T>主要用于 Sagas,我认为除此之外没有什么好的用例。
Context<TMessage>
一开始,使用All可能是正确的答案。