Jacky Phuong
Jacky Phuong

Reputation: 497

Mastransit - publish vs send and how to manage message

I have just used MassTransit in my project, .Net core2.0. It is great but there are some concerns:

Many thanks,

Upvotes: 9

Views: 14644

Answers (1)

Alexey Zimarev
Alexey Zimarev

Reputation: 19610

There are way too many questions for one post tbh, on SO it is better to ask more specific questions, one by one. Some of your questions already have answers on SO.

The difference between publishing events and sending commands is similar to what you expect. We actually cover some of it in the documentation.

You can handle as many message types as you want in one receive endpoint, but you need to be aware of the consequences. The best practice is to have one endpoint per command type or at least one endpoint for related commands. The risk here is that an important command might get stuck waiting in the queue until other, less important commands will be processed.

If you publish events, each endpoint (queue) will get a copy of it. If you have several instances of one endpoint, only one of those instances will get it. It is valid also for sending commands, but it will be only one endpoint that gets a message and only one of the instances will process it.

Although there is no documentation for MT testing just yet, you can look at this test to see how it is done.

MassTransit is compiled for .NET 4.6 and .NET Standard 2.0. There is nothing specifically different in .NET Core 2.1 that would have any effect on MassTransit.

Upvotes: 6

Related Questions