如何从 SQL 服务器向 RabbitMQ post 发送消息?

How to post messages to RabbitMQ from SQL Server?

我正在创建一个应用程序来测试不同 RabbitMQ 客户端之间的性能。
其中之一应该是 SQL 服务器。
我发现 SQL 服务器集成服务 (SSIS) 存在 RabbitMQ 组件。
但是似乎还没有编写可以将消息发送到交换器的目标组件。
有什么想法吗?
它应该与向 MSMQ 发布消息类似吗?

简短免责声明:我知道问题的标题,但根据您在评论中写的内容(当然还有问题本身),似乎您需要的是一个能够发送和接收许多消息的 RabbitMQ 客户端。

你不需要写任何东西,RabbitMQ 已经有这个了。你可以找到它 here, it's a java client called PerfTest (in the link there are also examples, but of course run it with --help) and (as name ever so obviously suggests) it is used for performance testing. You can define number of consumers, producers, messages, size of the messages etc. I have used it and still use it occasionally and it works great. Since you are (I'm assuming) new to RabbitMQ, just be vary how you pass the amqp uri parameter (here 是规范)。

您可以创建一个 SQLClr 来与 RabbitMQ 通信,就像这样 post

我不认为这是一个很好的解决方案,但它似乎有效。

最好的办法是使用安装在 SQL 机器上的命令行工具 rabbitmqadmin。然后你可以使用 xp_cmdshell 将消息发送到队列中。

https://www.rabbitmq.com/management-cli.html

DECLARE @Cmd VARCHAR(2000)
SET @Cmd = 'rabbitmqadmin publish exchange=amq.default routing_key=test payload="hello, world"'
EXEC [sys].[xp_cmdshell] @Cmd