Can my sql server send messages to activemq server

2019-07-04 06:09发布

问题:

We are using Sql 2012 database server. When ever the db modifies we want it to trigger a message that can be stored in a queue using activemq.

  1. We are not sure how can we code to trigger a db so that it sends a message.
  2. Can we directly make the message generated from db to get queued in activemq without any java interface in between. I would want to know whether we can achieve this or not. 3.Are there any other ways to set up a communication between sql server and activemq say between database services and activemq services(does activemq have that)

PS i am a new user of activemq. Any leads to solve these queries is appreciated.

回答1:

Please don't as SQL Server to do this. SQL Server is designed to store data. You are asking too much of it. Depending on how many places you would want to add to this queue from, I would choose one of the following solutions:

  1. If you want to add to this queue from a bunch of different places, and don't want to change existing code, create an application to move items from SQL Server to ActiveMQ. The items in SQL Server can be populated by a trigger.

  2. If there are only a few places that add to this queue, add that logic to the application so that every write to SQL Server will also write to ActiveMQ.

If you really still don't want to modify any code, you can configure ActiveMQ to use SQL Server as its persistence database. Then you can modify its data and hope that it plays nice. This is definitely not preferable. I would rather put CLR code into SQL Server to push data to ActiveMQ.