Mic*_*rry 7 .net msmq transactions
我正在编写一个Windows服务,它从MSMQ中提取消息并将它们发布到遗留系统(Baan).如果帖子失败或机器在帖子中发生故障,我不想丢失消息.因此我使用MSMQ交易.我失败了,我承诺成功.
在处理本地队列时,此代码运行良好.但在生产中,我想要将运行服务的机器(或机器)与队列本身分开.当我针对远程队列进行测试时,抛出System.Messaging.MessageQueueException:"事务使用情况无效."
我已经验证了有问题的队列是事务性的.
这是从队列接收的代码:
// Begin a transaction.
_currentTransaction = new MessageQueueTransaction();
_currentTransaction.Begin();
Message message = queue.Receive(wait ? _queueTimeout : TimeSpan.Zero, _currentTransaction);
_logger.Info("Received a message on queue {0}: {1}.", queue.Path, message.Label);
WORK_ITEM item = (WORK_ITEM)message.Body;
return item;
Run Code Online (Sandbox Code Playgroud)
我已经切换到SQL Service Broker.它支持远程事务接收,而MSMQ 3.0则不支持.而且,作为一个额外的好处,它已经使用我们集群和备份的SQL Server实例.
归档时间: |
|
查看次数: |
6864 次 |
最近记录: |