How to post messages to RabbitMQ from SQL Server?
Asked Answered
B

3

9

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?

Bachman answered 2/3, 2016 at 13:33 Comment(6)
What are you trying to do? A database stores data and responds to queries, it doesn't try to talk to integrate with other systems. While you can eg call external commands, the delay is attrocious, it involves relaxing security and it's simply a misuse of the database. SSIS is a different sevice, one made explicitly to ease integration between different systems, not just SQL Server.Edelman
I'm trying to compare sending and receiving capabillity of clients including sql server (messages per second).Bachman
A database isn't a messaging client. A web application on the other hand, is. What is the actual problem you are trying to solve? How to integrate different systems? Services? Web applications?Edelman
Note that SQL Server has its own messaging system, the Message Broker. Which wasn't very well received because well, as it's heavier than what most people want from messaging systems. It also requires configuration. While you could integrate Message Broker with RabbitMQ, it would be like shooting a fly with a howitzerEdelman
I just got a task to create different RabbitMQ clients that would send many messages to RabbitMQ. So after that we would be able to test their sending and receiving performance. I was thinking that I can send a messages to RabbitMQ for example from within a SQL Server stored procedure.Bachman
Note that NServiceBus supports queueing using both SQL Server (docs.particular.net/transports/sql) and RabbitMQ (docs.particular.net/transports/rabbitmq) and running a bridge between the two – docs.particular.net/nservicebus/bridgeNeckar
U
8

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).

Unsteady answered 2/3, 2016 at 22:11 Comment(2)
Sorry, downvoting because the OP wants to connect directly from SQL Server/SSIS. Java is not mentioned.Hards
@KeesdeKooter do as you must. I'm not going to quote the disclaimer I wrote at the beginning of the answer. I do appreciate the explanation for the -1Unsteady
K
2

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.

Kagera answered 7/3, 2017 at 13:26 Comment(3)
Please include the neccessary steps inside your answer body. While the post behind the link may solve the question, the link can go down and your answer becomes pretty much useless.Rawdan
this link not workingInverness
Morten makes a great point, because in 2024, that link still does not work and as someone looking for a solution it is frustrating. Sadly I see this more and more and it is a lazy way to put up an answer.Micronesian
A
2

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
Albeit answered 14/2, 2019 at 22:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.