WCF发布/订阅,具有订阅者缓存 [英] WCF Pub/Sub with subscriber caching

查看:129
本文介绍了WCF发布/订阅,具有订阅者缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:如何使用WCF提供分布式,可伸缩且抗灾的发布/订阅服务.

Problem: how to provide a distributed, scalable and disaster resistant pub/sub service with WCF.

详细信息:

请注意,除了消息传递/中间件解决方案(例如Tibco EMS)之外,还在考虑使用这种方法.

我一直在研究WCF,尤其是如何将其用于提供发布/订阅.关于这个主题,本文非常出色: WCF pub-sub .

I've been looking into WCF, particularly how it may be used to offer pub/sub. On this subject this article is very good: WCF pub-sub.

在本文中,作者试图解决拥有多个发布者的问题(就像一个服务发布者可以跨几个盒子扩展服务层一样).问题在于,如果客户端A在发布者A上注册,但发布者B希望发布事件,则发布者B将不了解客户端A.即,没有人告诉发布者B客户A希望收到有关事件的通知.作者建议使用发布/订阅服务作为解决方案.发布/订阅服务将集中存储订阅.但是,如果我想通过拥有辅助/双重发布/订阅服务来使发布/订阅服务具有抗灾难性,那么我也有同样的问题.

In the article the author attempts to tackle the problem of having multiple publishers (as one would have with a service layer scaled across several boxes). The problem being that if client A registers with Publisher A but Publisher B wishes to publish an event, then publisher B won't know about client A. i.e. no one told publisher B that client A wanted to be notified about events. The author suggests a pub/sub service as a solution. The pub/sub service would centrally store subscriptions. However, if I wanted to make the pub/sub service disaster resistant by having a secondary/dual pub/sub service then I have the same original problem.

因此,我认为有两种解决方案:

So, I think there are a couple of solutions to the problem:

  1. 将订户详细信息存储在分布式缓存中(请参阅问题: q1 q2 ).
  2. 将订户详细信息存储在数据库/中央文件系统中.
  1. Store subscriber details in a distributed cache (see questions: q1 and q2).
  2. Store subscriber details in a database/central file system.

有人能想到其他解决方案吗(即,我没有错过WCF的一些神奇的神奇功能吗?) 任何评论表示赞赏.

Can anyone think of any other solutions (i.e. I've not missed some fantastic magical feature of WCF?) Any comments appreciated.

推荐答案

我遇到了同样的问题,并且对此问题进行了大量研究.问题实际上很简单.您想保持某种集中状态,但要采用分布式方式.我发现实现此目标的最佳方法是使用分布式缓存.例如看速度.我知道没有本机WCF解决方案可以解决状态管理问题.我什至研究了持久服务,其中状态管理由WCF处理,但是不适用于pub/sub服务,因为状态需要集中到所有客户端连接.将数据存储在数据库中也是一种选择,但是代价是需要数据库,即使没有数据库,如果数据库不是集群的,那么即使有多个数据库,您也可能会遇到单点故障.

I had the same problem and I did a lot of research on the issue. The problem is actually simple. You want to keep some centralized state, but in distributed way. I found that the best way to achieve this is by using a distributed cache. Look at velocity for example. There is no native WCF solution that I know that can solve the state management issue. I have even looked into durable services, where state management is handled by WCF, however not suitable for a pub/ sub service, because the state needs to be centralized for all client connections. Storing data in a database is also an option, but the cost is the need for a database, and even with a database you can have a single point of failure if the database is not clustered accorss multiple machines.

最后,我认为实施具有零故障点的东西实际上是很昂贵的,如果您决定去那里然后看看Azure,存储的未来就在云上,Azure服务将完全可扩展和分布式,但我们还没有.

At the end, I figured it is actually expensive to implement something with zero points of failure and if you do decide to go there then take a look at Azure, the future of storage is on the cloud, Azure services will be fully scalable and distributed, but we are not there yet.

这篇关于WCF发布/订阅,具有订阅者缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆