當啓用集中存儲與MSMQ,有沒有別的什麼需要改變?這是我的,但代碼不會完全加載。如果我禁用集中存儲,則按預期工作。滷麪MSMQ集中存儲
_messageActivator = new BuiltinHandlerActivator();
_messageActivator.Register<PosOnlineHandler>(() => new PosOnlineHandler(WriteOutputAsync));
_messageActivator.Register<PumpDownHandler>(() => new PumpDownHandler(WriteOutputAsync));
_messageActivator.Register<MetersRequestHandler>(() => new MetersRequestHandler(WriteOutputAsync, _messageActivator.Bus));
_messageActivator.Register<CreditAuthorizationHandler>(() => new CreditAuthorizationHandler(WriteOutputAsync, _messageActivator.Bus));
Configure.With(_messageActivator)
.Transport(t => t.UseMsmq("consumerServiceQueue"))
.Routing(r => r.TypeBased()
.Map<PumpDownEvent>("publisherServiceQueue")
.Map<PosOnlineEvent>("publisherServiceQueue")
.Map<MetersResponse>("publisherServiceQueue")
.Map<CreditAuthorizationResponse>("publisherServiceQueue"))
.Subscriptions(s => s.StoreInSqlServer(@"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=test;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", "RebusSubscriptions", true, true))
.Start();
_messageActivator.Bus.Subscribe<PumpDownEvent>().Wait();
_messageActivator.Bus.Subscribe<PosOnlineEvent>().Wait();
謝謝。 Scott C.
你是什麼意思「代碼不會完全加載」? – mookid8000
對不起,它掛在Subscriber()。Wait()。 ....,我發現MessageBus示例使用集中的MSMQ存儲,所以稍後我會測試以查看是否得到相同的結果。 – scottctr
並且在30秒或1分鐘之後沒有超時? – mookid8000