Hi,
I have created a class library with a couple of interfaces IEvent and ICommand. The aim here was to allow projects to reference our class library to mark a class as a message, without needing to reference NServiceBus package directly.
I then created a custom convention as follows:
private void DefineEventConvention(ConventionsBuilder conventions)
{
conventions.DefiningEventsAs(type => typeof(MyLibrary.Interfaces.IEvent).IsAssignableFrom(type));
}
When I do this the below error message is logged on every event sent.
MyService.Contract.OrderPlacedEvent identified as event type by Modified NServiceBus Marker Interfaces but does not match message type convention. Treating as a message
The strange thing is, that using the learning transport the Event is published and received correctly by the message handler (even though the error message is still logged). But when the transport is switched to AzureServiceBus, the event is published, but never received by the message handler.
When I replace MyLibrary.IEvent with NServiceBus.IEvent, everything also works as expected (with no error message logged anymore). The question I have is, am I missing something when defining a convention? From reading the docs on conventions, it doesn’t appear that I am. I was also unable to find a reference to the exact error I am seeing else where. I would ideally like a solution that will still allow for engineers to mark a class as a message, without having to reference the NServiceBus NuGet package.