Is routing messages to the msdb SQL database required in SQL Service Broker?

久未见 提交于 2019-12-25 09:08:52

问题


In the examples I can find of communicating between server instances using SQL Server Service Broker (here and here), routes are created to the MSDB database which is one of the system databases. For example

use msdb;
go

create route [sender]
 with service_name = ‘sender’,
 address = ‘local’;
go

Why would I not create the route in the database that has the rest of the Service Broker objects such as message types and services? Is this how a production environment should do it?


回答1:


Messages received from network are routed inside the SQL Server instance according to routing rules of msdb. This is by convention, the routing rules have to be declared somewhere and we picked msdb. Normally msdb contains the AutoCreatedLocal route which makes all services, in any database, addressable. One can remove this global route and add explicit routes for some services, which will make only those services addressable. I didn't see this done in practice, though. Most times the AutoCreatedLocal route is left in place an will handle all incoming traffic.

Note that msdb routes are used for forwarding scenarios where a machine accepts messages from one network and route them onto another one.



来源:https://stackoverflow.com/questions/38472867/is-routing-messages-to-the-msdb-sql-database-required-in-sql-service-broker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!