间的pubsub没有网络依赖 [英] Interprocess pubsub without network dependency

查看:173
本文介绍了间的pubsub没有网络依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我已经安装在我的电脑上没有网卡,我想有类似以下功能:



流程1将消息发布到一些URI,说Uri1

  VAR出版商=新的出版商(Uri1); 
publisher.publish(新消息(Somedata);



2过程都将听关于Uri1消息和消息发布到Uri2

  VAR用户=新用户(Uri1)
subscriber.MessageReceived + =数据=> Console.Writeline(data.ToString());
变种出版商=新的出版商(Uri2)
publisher.Publish(新消息(SomeMoreData) )

流程3将监听距离的URI


$ b $消息b

  VAR用户=新用户(Uri1)
subscriber.MessageReceived + =数据=> Console.Writeline(data.ToString());
VAR anotherSubscriber =新用户(Uri2)
anotherSubscriber.MessageReceived + =数据=> Console.Writeline(data.ToString());

所有程序在同一台计算机上运行。经过一番研究,我相信MSMQ是去(使用队列名称作为的URI),但仍执行问题的方式。我碰到几个来了可能性:



使用MSMQ直接结果
我有这种方法的问题是,我将不得不管理队列我自己如创作,人口,从我读书,我可能会遇到许多陷阱和看到,因为我不与它



经历MSMQ的局限性清洗......也是< A HREF =http://www.nservicebus.com/相对=nofollow> NServiceBus ,的 MassTransit RhinoServiceBus (全部使用MSMQ)
他们似乎都能干,尤其是NServiceBus,但我似乎无法从文档弄清楚如何从它们中的任何提取基础的pubsub功能,这样我就可以在上面

使用的 WCF(超过MSMQ)
同样,这看起来像一个不错的选择,但看到我远从WCF的专家,我想确保这是去之前,我开始钻研它的方式



我们的方法到现在为止一直依靠PGM组播哪些工作还不错,但没有网卡的力量我们一起用另一种机制用于离线工作的,至少就我所知



感谢的新要求!


解决方案

在最后,我们选择了共享内存现成的解决方案:
http://pubsub.codeplex.com/
初始测试意味着它很适合我们的情况。


Suppose I have no network card installed on my computer, and I would like to have functionality similar to the following:

Process 1 will publish messages to some URI, say "Uri1"

var publisher = new Publisher("Uri1");
publisher.publish(new Message("Somedata");

Process 2 will both listen for messages on "Uri1" and publish messages to "Uri2"

var subscriber = new Subscriber("Uri1")
subscriber.MessageReceived += data => Console.Writeline(data.ToString());
var publisher = new Publisher("Uri2")
publisher.Publish(new Message("SomeMoreData"))

Process 3 will listen for messages from both URIs

var subscriber = new Subscriber("Uri1")
subscriber.MessageReceived += data => Console.Writeline(data.ToString());
var anotherSubscriber = new Subscriber("Uri2")
anotherSubscriber.MessageReceived += data => Console.Writeline(data.ToString());

All processes run on the same computer. After some research I believe MSMQ is the way to go (using queue names as URIs) but the implementation question remains. I came across several possibilities:

Using MSMQ directly
The problem I have with this approach is that I would have to manage the queues my self e.g. creation, population, purging... also from what I read I may encounter many pitfalls and limitations of MSMQ seeing as I am not experienced with it

Using NServiceBus, MassTransit or RhinoServiceBus (all use MSMQ) They all seem competent, especially NServiceBus, but I can't seem to figure out from the documentation how to extract the basic pubsub functionality from any of them so that I could encapsulate it in an interface similar to the above

Using WCF(over MSMQ) Again this looks like a good option, but seeing as I am far from a WCF expert I would like to make sure this is the way to go before I start delving into it

Our approach up until now has relied on PGM multicast which worked well enough, but the new requirement of working without a network card forces us to use another mechanism for offline work, at least as far as I know

Thanks!

解决方案

In the end, we chose a shared memory ready-made solution: http://pubsub.codeplex.com/ Initial testing imply it works well for our case

这篇关于间的pubsub没有网络依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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