将消息从 SQL 添加到 Azure 服务总线队列

将消息从 SQL 添加到 Azure 服务总线队列

问题描述:

我的一个数据库表上有一个 SQL 触发器,并且想在执行 SQL 触发器时向我的 Azure 服务总线队列添加一条消息.

I have a SQL trigger on one of my database tables and would like to add a message to my Azure Service Bus Queue when the SQL trigger is executed.

有人有如何执行此操作的 SQL 代码示例吗?

Does anyone has a SQL code example of how to do this?

值得一提的是,SQL 将在 Azure 中运行的 SQL 数据库中运行.

It's worth mention that SQL will be running in a SQL database which is running in Azure.

请不要开始讨论是否使用 SQL 触发器的问题,这纯粹是为上述问题获取可用的 SQL 代码.

Please do not start a discussion of the question of using SQL triggers or not this is purely get working SQL code for the question above.

不清楚您的 SQL 是在 VM 还是 SQL 数据库上运行.您可以做的是创建一个 CLR 存储过程并通过 REST API 调用 Azure 服务总线.

It's not clear if your SQL is running on a VM or SQL Database. What you could do is create a CLR Stored Procedure and call the Azure Service Bus through REST APi.

https://blogs.msdn.microsoft.com/sqllive/2008/06/18/accessing-rest-based-web-services-using-sql-clr/

通过 REST API 的 Azure 服务总线队列

Azure Service Bus Queue through REST API

https://docs.microsoft.com/en-us/rest/api/servicebus/queues