views:

181

answers:

2

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!

A: 

Well, according to http://answers.yahoo.com/question/index?qid=20080616091430AAAxTJB you can use the loopback address without a NIC installed. Maybe you can use that functionality to continue using your existing code?

Note: I have not tested this, it was just an idea.

TJMonk15
Thanks, I'll give it a shot tomorrow though I believe I wouldn't be able to bind a PGM socket to 127.0.0.1 .. It is my understanding that either the network card or the router are responsible for multicasting and in the absence of both I don't see how the existing code would work
ohadsc
OK, so I can't bind a PGM socket to 127.0.0.1. UDP doesn't work either, since I can't multicast or braodbast to 127.0.0.1... any ideas ?
ohadsc
Sigh, Sorry. Thought it was worth a shot anyways.
TJMonk15
A: 

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

ohadsc