SQL Server 中的 Service Broker 是什么?
SQL Server 中的 Service Broker 是什么?在简单数据库(而不是分布式数据库)中启用它是否有意义?
What is Service Broker in SQL Server and is it meaningful to enable it in a simple database, not in a distributed database?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
SQL Service Broker 是一种扩展机制,允许您对事件进行排队以进行异步处理。
启用代理并没有本质上的危害。如果不使用,它就会闲置。
它适用于简单数据库和分布式数据库。一个简单的用例是日志队列。我们在客户端使用它来对要异步处理的 XML 消息进行排队。因此,我们将 XML 推送到 InitatorQueue,然后让服务从队列中提取它们,通过 XPath 提取一些必要的属性,并将它们插入到数据库中的持久性表中。
这里是来自 Microsoft 的一个很好的参考。
SQL Service Broker is an extension mechanism that allows you to queue events for asynchronous processing.
There is no intrinsic harm in enabling the broker. If it's not used, it will just be idle.
It works in both simple and distributed DBs. A simple use case would be a logging queue. We used it at a client to queue XML messages to be processed asynchronously. So we push an XML to an InitatorQueue, and then had a service pull them from the queue, extract some necessary attributes via XPath, and insert them into a persistence table in our database.
Here is a good reference from Microsoft.
Service Broker 是内置于 SQL Server 数据库引擎中的消息传递系统。
您可以阅读以下一些文章来了解它是如何工作的。
使用 Service Broker 进行集中式异步审核
跨实例和服务器的集中式异步审核与服务代理
如何排查 Service Broker 问题
Service Broker is a messaging system built into the SQL server db engine.
Here's some articles you might read to see how it works.
Centralized Asynchronous Auditing with Service Broker
Centralized Asynchronous Auditing across Instances and Servers with Service Broker
How to troubleshoot Service Broker problems
Service Broker 是一个异步消息传递系统。它允许您向队列发送消息。然后某个工作进程接收该消息。无法保证订单或何时收到消息。但 SQL Server 确实保证消息处理以事务方式进行。
异步消息传递是最重的架构之一。您应该仔细考虑附加值是否值得复杂性。
Service Broker is an asynchronous messaging system. It allows you to send a message to a queue. Then some worker process picks up the message. There are no guarantees about the order, or when, a message is picked up. But SQL Server does guarantee that message processing happens in a transactional way.
Asynchronous messaging is one of the heaviest architectures out there. You should consider carefully whether the added value is worth the complexity.