我可以确保sql servicebroker中对话的顺序吗?
因此,我有一台“A”服务器和一台“B”服务器。我们使用 SQL Service Broker 来执行复制。我们的应用程序需要将数据写入“A”服务器或“B”服务器。 (一个可能已关闭,另一个应该接管)
数据仅在存储过程中写入数据库,这些存储过程包装在事务中以保持表中的数据一致。
这些事务之一将包括要发送到对等服务器的所有消息。因此,在我的应用程序代码中,当我尝试提交事务时,它应该将所有数据写入表中,并将消息发送到对等服务器。
但是,如果对等服务器关闭,则消息将在 sys.transmission_queue 中等待。
保证对话对话中的消息顺序,但我可以确保对话对话将按照我创建对话的顺序进行处理吗?
例如,如果“B”服务器关闭,我可能会遇到问题,用户将数据写入“A”服务器。一旦“B”服务器再次备份,如果这些对话的处理顺序不正确,它们可能无法正常工作。 (他们可能会尝试插入带有错误外键的数据,或者类似的东西)。
我在以下假设下工作:
我应该有一个对话框 每笔交易的对话。
溶液的形式必须是 通过sql服务进行复制 经纪人。 (这是在其他 数据库的一部分,所以任何原因 使用替代策略必须是 引人注目)。
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 example, 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:
I should have a single dialog
conversation for each transaction.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).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该使用代理优先级。http://msdn.microsoft.com/en-us /library/bb934170.asp
You should user Broker Priority.http://msdn.microsoft.com/en-us/library/bb934170.asp