开发者

Sending messages from multiple servers to one Service Broker Queue

开发者 https://www.devze.com 2023-04-07 01:00 出处:网络
I have a couple of SQL servers with databases supporting two different applications. I need tocapture changes to similar data from each database, but process it sequentially. Service Broker fits the b

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号