开发者

Can I ensure the order of dialog conversations in sql service broker?

开发者 https://www.devze.com 2023-01-14 01:24 出处:网络
So, I\'ve got an \'A\' server and a \'B\' server.We are using SQL Service Broker to perform replication.An application we have will need to write data to either the \'A\' server, or the \'B\' server.(

So, I've got an 'A' server and a 'B' server. We are using SQL Service Broker to perform replication. An application we have will need to write data to either the 'A' server, or the 'B' server. (one may be down, and the other one should take over)

Data is written to the database only within stored procedures, which are wrapped in a transaction to keep the data in the tables consistent.

One of these transactions will include all of the messages to be sent to the peer server. So, in my application code, when I attempt to commit a transaction, it should write all of the data to the tables, and send the messages to the peer server.

However, if the peer server is down, then the messages will wait in sys.transmission_queue.

Message order within a dialog conversation is guaranteed, but can I ensure that dialog conversations will be processed in the order that I created them?

For ex开发者_如何学Cample, I could have a problem if the 'B' server is down, A user writes data to the 'A' server. Once the 'B' server is back up again, if those dialog conversations are processed out of order, they may not work correctly. (They could try to insert data with a bad foreign key, or something like that).

I am working under the following assumptions:

  1. I should have a single dialog conversation for each transaction.

  2. The form of the solution must be as replication by way of sql service broker. (This is done in other parts of the database, so any reason to use an alternate strategy must be compelling).


You should user Broker Priority.http://msdn.microsoft.com/en-us/library/bb934170.asp

0

精彩评论

暂无评论...
验证码 换一张
取 消