
Locating the Destination Service
As described earlier, Service Broker delivers messages to a service in the current instance when the matching route specifies 'LOCAL' as the network address. For messages that originate outside the instance, the route must be in msdb.sys.routes. For messages that originate in the instance, the matching route must be in the sys.routes table for the database that initiates the conversation.
When Service Broker determines that the service for the message is in the current instance, Service Broker must locate the service in the instance. When a Service Broker identifier for the conversation exists in either the conversation or the route, Service Broker delivers messages to the database identified by the Service Broker identifier.
Otherwise, Service Broker locates the service by first searching for the service name in the database that contains the conversation. Then, it searches for the service name in the other databases in the instance. Service Broker delivers the message to the first service located. Notice, however, that the order in which Service Broker searches the other databases in an instance is unspecified, and is not guaranteed to be consistent from conversation to conversation. This means that if more than one copy of the target service exists in the instance, Service Broker randomly picks the service to target.