Search code examples
masstransit

Is there any detailed API documentation for the entirety of MassTransit?


I'm trying to implement MassTransit as I see the benefits it provides my code base. I am struggling to understand how everything relates and what is available at what point to manipulate, i.e. ExchangeType only exists on specific implementations and not the root IReceiveEndpointConfigurator interface. I can read through github but the time involved versus reading API documentation is vastly different. Does such a source exist? Or should I resolve myself to slower implementation and 'experience' for knowledge?

I have read and re-read masstransit.io. I get the concepts, just not the implementation details. I feel a read through of RabbitMQ's documentation would only garner me knowledge of that system that doesn't universally apply to what MassTransit can do.

For my specific scenario, I've abstracted specific message bus domains into their own projects and configuring them from a useful perspective seems laborious. I want an endpoint to always be Direct, not Fanout, but I can't call a single property on a single interface to make that so. I have to instead check for each implementation type, cast, and then set the property per each backend supported by MT because there is no base interface to support it. Is this really the pattern? I thought abstracting implementations away from usage was the whole point yet I have to dig into each implementation type to set ExchangeType or various other properties on my endpoints. I feel I'm missing something in this regard because in my mind this isn't how it's supposed to be because it's an entire abstraction layer.


Solution

  • MassTransit is an abstraction layer, but details like configuring exchange types, etc. are broker-specific and as such are only included in that brokers configuration interfaces. The architecture of MassTransit allows for common interfaces for common things, such as consumers, messages, entity names, etc. and then has broker-specific methods to have granular control to all broker features.

    I want an endpoint to always be Direct, not Fanout, but I can't call a single property on a single interface to make that so.

    That would be on IRabbitMqPublishTopologyConfigurator, where you would specify an exchange type that actually routes message. Because, frankly, changing an "endpoint" to be direct is pointless.

    You can't abstract away the specific, and the alternative of having a lowest common denominator of supported features is a way too simple for any modern framework to provide a useful abstraction.

    The way MassTransit is architected, your core domain (business logic) relies only on the common interfaces (consumers, sagas, etc.) and the outer configuration layer deals with the broker-specific configuration details. It's always possible to pattern match against a specific broker implementation to configure things within consumer definitions, saga definitions, etc. as well as use configuration callbacks to specify per-endpoint details.