WCF callback with multiple clients

妖精的绣舞 提交于 2020-01-01 12:08:07

问题


Can I have two different clients listening to the same WCF callback and have them both receive the same data without having to do the processing twice?


回答1:


Not really - at least not directly. What you're describing sounds a lot like the publish/subscribe pattern. A WCF service basically services one client and one client only, at any given time.

There are ways to do this in WCF 3.5 and better ones in WCF 4.0 - with or without Windows Azure's .NET Services. There are also other tools and support for the publish/subscribe pattern.

Check out things like:

  • WCF Implementation of the Publish/Subscribe model
  • Building a Pub/Sub Message Bus with WCF and MSMQ
  • NServiceBus

If you Google or Bing for "WCF Publish Subscribe", you'll get a lot more hits - but those three should really get you started, I think.




回答2:


In addition to the links @marc_s posted, you can also check out Juval Lowy's Publish/Subscribe Framework, which is shown graphically below.


(source: microsoft.com)
.

This framework is described in detail in this MSDN article. And you can download the framework's source code for free at Lowy's website, IDesign.net.

Using the Pub/Sub Service allows the Publisher to publish the event once to a well-known endpoint. The Pub/Sub Service then takes care of publishing the notification to the subscribed clients.



来源:https://stackoverflow.com/questions/3152703/wcf-callback-with-multiple-clients

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