I have a NServiceBus version 3.3.8 Saga that I am working on migrating from NServiceBus 2.6. After I upgraded it, I have found that a single message in the queue is getting processed twice by the saga. What is most strange about it is that NServiceBus is treating this as two separate Transport Messages because my IMessageModule implementation is getting called twice as well.
The message it is receiving is a message bound to NServiceBus 2.6. Has anyone seen this before? I at first thought it was a dependency injection issue, as we are switching from Unity to Autofac, but that doesn't seem to explain the issue with the MessageModule getting called twice.
I appreciate any help you can provide.
UPDATE
It turns out that the issue was a dependency injection issue that I had inadvertently created. The saga has some additional dependencies that require IBus and the IBus is a property and set via property injection. Using an Autofac module, I tried to simplify the configuration by overriding the AttachToComponentRegistration and injecting properties on all registered items like this:
protected override void AttachToComponentRegistration(IComponentRegistry componentRegistry, IComponentRegistration registration) {
registration.Activating += (s, e) => e.Context.InjectProperties(e.Instance);
}
This, however, caused the issue above. To fix it, I removed this override and manually set up property injection via a call to:
builder.RegisterType<Implementation>().As<Interface>().PropertiesAutowired();
This resolved my duplicate processing issue. I am still not sure why it caused the issue, but removing that override did prevent the duplicate message handling.