Andrei Karcheuski
Andrei Karcheuski

Reputation: 3306

How to post messages to RabbitMQ from SQL Server?

I am creating an application for testing performance between different RabbitMQ clients.
One of them should be SQL Server.
I found out that there exists RabbitMQ component for SQL Server Integration Services (SSIS).
But seems like destination component which can send messages to an exchange is not written yet.
Any ideas how to perform that?
Should it be similar with posting messages to MSMQ?

Upvotes: 9

Views: 24194

Answers (3)

Russell Fox
Russell Fox

Reputation: 5435

Best bet would be to use the command line tool, rabbitmqadmin, installed on your SQL machine. Then you can use xp_cmdshell to send messages into the queue.

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

Upvotes: 2

Fabricio Doi
Fabricio Doi

Reputation: 80

You can create a SQLClr to comunicate with a RabbitMQ, like in this post.

I don't believe it's a nice solution, but it seems to work.

Upvotes: 2

cantSleepNow
cantSleepNow

Reputation: 10192

Short disclaimer: I am aware of the title of the question, but based on what you wrote in the comments (as well of course in the question itself), it seems that what you need is a RabbitMQ client that is able to send and receive many messages.

You don't need to write anything, there is RabbitMQ has this already. You can find it 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 is the spec).

Upvotes: 8

Related Questions