带 TransactionScope 的 Rebus 处理程序
我已经设置了一个 Rebus 处理程序,并将事务范围附加到 MSMQ 和 RabbitMQ。处理程序 100% 处理前几条消息。几分钟后,当我尝试向队列发布新消息时,我收到以下错误消息......
我做错了什么?
[11:09:59 ERR] An error occurred when attempting to complete the transaction context
System.Transactions.TransactionAbortedException: The transaction has aborted.
---> System.TimeoutException: Transaction Timeout
--- End of inner exception stack trace ---
at System.Transactions.TransactionStateAborted.BeginCommit(InternalTransaction tx, Boolean asyncCommit, AsyncCallback asyncCallback, Object asyncState)
at System.Transactions.CommittableTransaction.Commit()
at System.Transactions.TransactionScope.InternalDispose()
at System.Transactions.TransactionScope.Dispose()
at Rebus.TransactionScopes.TransactionScopeTransportDecorator.<>c__DisplayClass7_0.<Receive>b__1(ITransactionContext ctx)
at Rebus.Transport.TransactionContext.Dispose()
at Rebus.Transport.TransactionContext.Complete()
at Rebus.Workers.ThreadPoolBased.ThreadPoolWorker.ProcessMessage(TransactionContext context, TransportMessage transportMessage)
// Initialize Class
_activator = new BuiltinHandlerActivator();
// Register
_activator.Register((context, handler) => new Handler(_activator.Bus));
// Configure
Configure.With(_activator)
.Logging(logging => logging.Serilog())
.Options(options =>
{
options.HandleMessagesInsideTransactionScope();
options.SimpleRetryStrategy(maxDeliveryAttempts: 1, secondLevelRetriesEnabled: true);
options.SetMaxParallelism(5);
options.SetNumberOfWorkers(5);
})
I have setup a Rebus handler with a Transaction Scope attached to it to MSMQ and RabbitMQ. The handler handles the first few messages 100%. After a couple of minutes when I try publish new messages to the queue I get the error message below....
What am I doing wrong?
[11:09:59 ERR] An error occurred when attempting to complete the transaction context
System.Transactions.TransactionAbortedException: The transaction has aborted.
---> System.TimeoutException: Transaction Timeout
--- End of inner exception stack trace ---
at System.Transactions.TransactionStateAborted.BeginCommit(InternalTransaction tx, Boolean asyncCommit, AsyncCallback asyncCallback, Object asyncState)
at System.Transactions.CommittableTransaction.Commit()
at System.Transactions.TransactionScope.InternalDispose()
at System.Transactions.TransactionScope.Dispose()
at Rebus.TransactionScopes.TransactionScopeTransportDecorator.<>c__DisplayClass7_0.<Receive>b__1(ITransactionContext ctx)
at Rebus.Transport.TransactionContext.Dispose()
at Rebus.Transport.TransactionContext.Complete()
at Rebus.Workers.ThreadPoolBased.ThreadPoolWorker.ProcessMessage(TransactionContext context, TransportMessage transportMessage)
// Initialize Class
_activator = new BuiltinHandlerActivator();
// Register
_activator.Register((context, handler) => new Handler(_activator.Bus));
// Configure
Configure.With(_activator)
.Logging(logging => logging.Serilog())
.Options(options =>
{
options.HandleMessagesInsideTransactionScope();
options.SimpleRetryStrategy(maxDeliveryAttempts: 1, secondLevelRetriesEnabled: true);
options.SetMaxParallelism(5);
options.SetNumberOfWorkers(5);
})
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论