Sending messages to two services simultaneously usind Service Brokers
could I send messages from one service to multiple service using service brokers?
开发者_StackOverflow社区Something like
BEGIN DIALOG CONVERSATION @dialog_handle
FROM SERVICE [SERVICE1]
TO SERVICE 'SERVICE2',**'SERVICE3'**
ON CONTRACT [MainContract]
Looking at the syntax, I do not think we could do this. What's the alternative?
Thanks and Regards
DEE
There is no publish-subscribe nor multicast built in into Service Broker. To send a message to multiple services you have to explicitly send it to each destination an o a separate dialog.
The typical solution is to send only one message from the application to a service that acts like a distributor. The distributor service receives this message and sends a copy of it to each interested service (Service2, Service3 etc). This way the application doesn't need to know upfront how many services it needs to send the message to, it just sends it to the distributor service.
精彩评论