It is certainly confusing. I didn’t design the system, I’m just trying to upgrade it.
But yes, the command is handled by a different process endpoint than the one containing the saga.
The application contains three separate endpoints (Billing, BillGen, and Posting), each running in their own Host process. A task kicks off a process in Billing, which then fires a
PostAssociationCommand command to Posting, where the saga lives. The saga originally contained a mapping for two command handlers,
mapper.ConfigureMapping<PostAssociationCommand>(message => message.SagaKey).ToSaga(saga => saga.SagaKey);
mapper.ConfigureMapping<PostAssociationCompanyBillCommand>(message => message.SagaKey).ToSaga(saga => saga.SagaKey);
PostAssociationCommand handler runs, which in turn fires off several hundred
PostAssociationCompanyBillCommand commands. Now, despite the saga having a mapping to
PostAssociationCompanyBillCommand, it’s handler is actually in Billing, not Posting.
In NServiceBus 5, this worked fine. Messages were fired between hosts as expected, and the command mapping in the saga was fine. In NServiceBus 6, this no longer works, the Posting process (containing the saga) crashes with an error:
System.Exception: Saga AssociationPostingSaga contains a mapping for PostAssociationCompanyBillCommand in the ConfigureHowToFindSaga method, but does not handle that message. If AssociationPostingSaga is supposed to handle this message, it should implement IAmStartedByMessages<PostAssociationCompanyBillCommand> or IHandleMessages<