Мои обработчики событий не имеют автоматической подписки.Я использую NServiceBus-CI 3.0.2044.У меня была такая же проблема с NServiceBus-CI 3.0.2027.
<MsmqTransportConfig ErrorQueue="dwh.projectmanagement.documents.notifications.error" NumberOfWorkerThreads="1" MaxRetries="5" />
<UnicastBusConfig ForwardReceivedMessagesTo="dwh.admin.auditor">
<MessageEndpointMappings>
<add Messages="DWH.Login.EmployeeLoggedInToTIPS, DWH.Events" Endpoint="dwh.webeventpublisher" />
<add Messages="DWH.Login.BuyerLoggedIn, DWH.Events" Endpoint="dwh.webeventpublisher" />
<add Messages="DWH.ProjectManagement.Events" Endpoint="dwh.projectmanagement.commandhandlers" />
<add Messages="DWH.ProjectManagement.Documents.DocumentDistributor.Events" Endpoint="dwh.projectmanagement.documents.documentdistributor" />
</MessageEndpointMappings>
</UnicastBusConfig>
class EndpointConfig : IConfigureThisEndpoint, AsA_Server , IWantCustomInitialization
{
public void Init()
{
log4net.Config.XmlConfigurator.Configure();
var kernel = new StandardKernel();
Configure.With()
.NinjectBuilder(kernel)
.CustomJsonSerializer();
.MsmqTransport()
.IsTransactional(true)
.UnicastBus()
.LoadMessageHandlers()
.CreateBus()
.Start();
// Other DI bindings
}
}
DocumentVersionSignedByBuyer
в DWH.ProjectManagement.Events
сборке.
public class SalesConsultantNotification :
IHandleMessages<DocumentVersionSignedByBuyer>
{
public IBus Bus { get; set; }
private readonly ISalesQueries _salesQueries;
public SalesConsultantNotification(ISalesQueries salesQueries)
{
_salesQueries = salesQueries;
}
public void Handle(DocumentVersionSignedByBuyer message)
{
var salesConsultants = _salesQueries.GetSalesConsultants(message.SaleId);
foreach (var salesConsultant in salesConsultants)
{
var cmd = new NotifySalesConsultantBuyerSigned(salesConsultant, message);
Bus.Send(cmd);
}
}
}