[Question] How to implement integration events using higher-level frameworks?
eShopOnContainers uses the lower-level SDKs of the message brokers and the wiki suggests using other solutions that provide another abstraction on top of the message broker like NServiceBus or MassTransit.
I'm using MassTransit but I believe my problem applies to the other libraries as well: MassTransit uses the name of the message's type for routing through the message broker as well as for deserialization on the consumer side. The problem is that they use the full name of the type, including the namespace. I believe that this was designed with the assumption that both sides of the integration share a .NET assembly with a common type, and sharing code like that between microservices is not such a good idea.
So the only two ways I can see to implement asynchronous messaging with type-based routing are:
- Share event definitions with a common .NET assembly (and increase the coupling between the microservices)
- Define the events separately in each microservice but use the same namespace for classes that represent the same event. This feels a bit wrong because I have multiple types with the same name in the same namespace, but it's definitely possible because they are located in different assemblies.
Is there another solution I'm missing? what is the recommended approach to using type-based event routing?
I'm stuck with the same problem, Are there any ideas?
Sharing event definitions in a .net assemblies looks a correct way. In a recent projects that I worked with these assemblies published via nuget as versioned contracts. But nothing wrong with option 2 from my perspective as it provides flexibility and independency.
I am closing this issue now since it is opened for a very long time with no activity.