結束我處理事件與HandleMyEvent類NServiceBus事件超時隊列
public class HandleMyEvent : IHandleMessages<MyEvent>
{
private readonly IBus _bus;
private readonly IWorkorker _workerTools;
public HandleProductInstanceEvent(IBus bus, IWorkorker worker)
{
_bus = bus;
_workerTools = worker;
}
public void Handle(IProductInstancesUpdatedEvent message)
{
var worker = new myWorker(_bus, _worker);
myWorker.DoWork(message.data);
}
}
myWorker.DoWork可以爲其做之前長達5分鐘。
當發佈者發送一個「MyEvent」時,看起來處理程序在消息在超時隊列中結束之前收到5個事件,我猜測它在放棄之前會重試5次。
在日誌文件中我能找到這個入口
NServiceBus.Unicast.Queuing.FailedToSendMessageException: Failed to send message to address: [email protected] ---> System.Messaging.MessageQueueException: Cannot enlist the transaction.
at System.Messaging.MessageQueue.SendInternal(Object obj, MessageQueueTransaction internalTransaction, MessageQueueTransactionType transactionType)
at NServiceBus.Transports.Msmq.MsmqMessageSender.Send(TransportMessage message, Address address) in c:\work\3206e2123f54fce4\src\NServiceBus.Core\Transports\Msmq\MsmqMessageSender.cs:line 59
爲什麼會出現這個錯誤?
Added Configure.Transactions.Advanced( settings => settings.DefaultTimeout(TimeSpan.FromMinutes(10)));到我的端點配置,現在它工作:) – CruelIO