Hi,
I've implemented some microservices with NServiceBus already and I want to reimplement the project in MassTransit (mostly because it's free and maybe performs better).
I've read the documentation and searched around but I've got no precise answer to my questions. I've several microservices (like Identity, Passenger, Flight, Hotel, Fiscal, etc.) which are implemented as a console application in a docker container so that I can easily scale them.
I kindly ask please mention the question number while you are answering ;-)
- NServiceBus usually makes one queue per microservice, is it a good practice in MassTransit too? or you suggest one queue per group of related messages?
- In some microservices I've many message types (commands, events). Do I need to register each consumer one by one?? like:
cfg.ReceiveEndpoint(host, "customer_queue", e =>
{
e.Consumer<MessateType1Consumer>();
e.Consumer<MessateType2Consumer>();
e.Consumer<MessateType3Consumer>();
e.Consumer<MessateType4Consumer>();
...
});
or is there a way to register all at once? I've seen many examples but all of them have only one consumer to register :-(
3. Is it better to have one C# class for each consumer, or to have one class for consuming many message types (maybe a workaround for registering many message consumer at once)?
4. I've a base Command interface type, so that I can make sure all commands have specific properties (and so for events), but I use the child interface for Send/Publish. Is it okay? because in the docs it's written:
A common mistake when engineers are new to messaging is to create a base class for messages, and try to dispatch that base class in the consumer – including the behavior of the subclass. Ouch. This always leads to pain and suffering, so just say no to base classes.
So I've no idea is it related to what I'm doing or not? because I don't dispatch the base class, I only dispatch child classes (but maybe somewhere I consume a base class).
I really appreciate your kind attention, and thank you for making such a great framework :-)