这是我的棘手问题。关于如何从数据库推送数据而不是应用程序拉数据。
通过链接和文件后,我知道我需要在应用程序端编写一个查询以获取通知请求,然后数据库将在订阅中注册我的请求,如果数据库有任何更改,它将检查订阅,如果请求在那里它会将消息发送给客户端。
此段来自上述链接
Along with the query submitted for the notification, the client submits a service name
and a broker instance. Each notification subscription begins a Service Broker dialog
with this provided service and broker instance. When data is changed and the change
would affect the result of the submitted query result, a message is sent on this
dialog. By sending this message, the client is considered notified and the notification
subscription is removed. If client desires to be notified on further changes, is
supposed to subscribe again.
现在我不知道如何在应用程序端为通知请求编写查询,而且我不理解submit a service and a broker instance
上面给出的段落。我猜在查询数据库以获取通知请求之前,需要在应用程序中创建服务和代理实例。如果是这样,如何创建服务和代理实例?
select * from sys.dm_qn_subscriptions
我可以通过命令检查数据库服务器的订阅。谁能帮我?