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

StackOverflow https://stackoverflow.com/questions/17588863

  •  02-06-2022
  •  | 
  •  

Domanda

I've started looking at MassTransit and am writing the classes that will handle the 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 them be used?

È stato utile?

Soluzione

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

Starting off, just using All is likely the right answer.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top