开发者

Sending messages to two services simultaneously usind Service Brokers

开发者 https://www.devze.com 2022-12-15 03:05 出处:网络
could I send messages from one service to multiple service using service brokers?开发者_StackOverflow社区

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.

0

精彩评论

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