简体   繁体   English

Sql Server Service Broker如何与MSDTC进行交互

[英]How does Sql Server Service Broker interact with MSDTC

We have a situation where we are sending a message on a Service Broker queue as part of a distributed transaction. 我们有一种情况,我们在Service Broker队列上发送消息作为分布式事务的一部分。 Obviously we only want the message sent if the transaction completes. 显然,我们只希望交易完成后发送消息。

However we are finding that in this situation, the recieving end of the queue recieves the message before the transaction commits, somehow becoming enrolled too. 但是,我们发现在这种情况下,队列的接收端在事务提交之前就已经接收到消息,并且也以某种方式被注册。 This is causing knock on problems if the sender then rolls back, eventually leading to the queue being disabled due to poison messages. 如果发件人然后回滚,这会导致连锁问题,最终导致队列由于有毒消息而被禁用。

Is this expected behaviour? 这是预期的行为吗? If so, how can we send messages transactionally? 如果是这样,我们如何通过交易发送消息?

Could it be so, that you are reading queue with NOLOCK hint? 难道是您正在阅读带有NOLOCK提示的队列? in that case- you can see message in the queue, but actually you cannot receive it! 在这种情况下,您可以在队列中看到消息,但实际上您收不到消息! And only after transaction commits, it can be received. 而且只有在事务提交后,它才能被接收。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM