What is the difference between needs. For, Consumes.Selected, Consumes.All and Consumes.Context in MassTransit?

I started looking at MassTransit and am writing classes that will handle messages. When I implement the interface from Consumes<T> , I get four options: All , Selected , For<T> and Context . What is the difference between the four and when should they be used?

+6
source share
1 answer

All just gives you all the messages for consumption. Context That's all, but you also get Context<TMessage> if you need it. Selected allows you to accept or decline messages before they reach your consumer. For<T> primarily for Sagas, I don't think this is a good use case outside of this.

Running, just using All , is most likely the correct answer.

+6
source

Source: https://habr.com/ru/post/949199/


All Articles