Sending messages from multiple servers to one Service Broker Queue
I have a couple of SQL servers with databases supporting two different applications. I need to capture changes to similar data from each database, but process it sequentially. Service Broker fits the bill, I just have a couple o开发者_StackOverflow中文版f implementation questions.
I've created a "third" database for extending the two applications. On this database, I've enabled service broker, created a message schema, contracts, service and queue.
If I want to send messages of this type //mysite.com/extensions/message
to an ExtensionsQueue
on EXTENSIONSERVER.Database
from LEGACYSERVER.Database
, do I need to run the SQL statements to create those pieces (schema, contract, message, etc) in each database I want to talk to this queue from? It seems that, minimum, I would need the message schema in each database to force integrity.
Assuming I need to (which only seems to make sense) should I name the services, queues, etc on each server the same, or will that cause issues? For example, should I name the service on the EXTENSIONSERVER
something like //extensionserver/extensions/message
and //legacyserver/extensions/message
? Do I even need to create a service and queue on LEGACYSERVER
or would a route like this take care of it?
CREATE ROUTE
WITH
SERVICE_NAME = '//extensionserver/extensions/message',
ADDRESS = 'extensionserver:1433'
This actually turned out to be quite a setup. I ended up mostly following this tutorial.
One key point that it didn't mention though was routes for external database instances need to be in the MSDB database.
精彩评论