Multiple NICs and MassTransit

70 views
Skip to first unread message

Jean Lambert

unread,
May 16, 2013, 4:09:07 PM5/16/13
to masstrans...@googlegroups.com
Hi, I am currently experiencing some design challenges with a system that uses multiple network interface cards each having they own sub-nets.

Setup is as follows:

Host A, eth0: 192.168.1.1, eth1: 10.150.1.1
Host B, eth0: 192.168.1.2
Host C, eth0: 10.150.1.2

Host A is connected to Host B and Host C throughout different networks.
Host A is running RabbitMQ and a process which uses MassTransit.
Host A uses a request-reponse pattern to communicate with Host B and Host C.

The service bus setup on A is as follows:

var bus = ServiceBusFactory.New(sbc =>
{
  sbc.UseRabbitMq();
  sbc.ReceiveFrom("rabbitmq://192.168.1.1/HostA");
}

When sending a message to B for example, I do something like:

var e = bus.GetEndpoint("rabbitmq://192.168.1.1/HostB");
e.SendRequest(new MyMessage(), bus, x =>
{
  x.Handle<IExpectedResponse>(r => { // do something });
  x.SetTimeout(TimeSpan.FromSeconds(30));
  x.SetRequestExpiration(TimeSpan.FromSeconds(10));
}

Host B has a consumer for MyMessage() and uses context.Respond(new ExpectedResponse());

This works fine.

Now, repeat scenario but with Host C.

var e = bus.GetEndpoint("rabbitmq://192.168.1.1/HostC");
e.SendRequest(new MyMessage(), bus, x =>
{
  x.Handle<IExpectedResponse>(r => { // do something });
  x.SetTimeout(TimeSpan.FromSeconds(30));
  x.SetRequestExpiration(TimeSpan.FromSeconds(10));
}

The message is sent and received by HostC, but here is where it gets interesting doing a  context.Respond(new ExpectedResponse()) does not work.

After some investigation it was discovered that context.ResponseAddress was rabbitmq://192.168.1.1/HostA which Host C cannot see since he is on the 10.150.1.2 net.

What strategy is best in such a situation?

Should I have on Host A as many service bus instances as I have network cards and use the right one based on whom I'm communicating with?

Should I set my own ResponseAddress?

Any suggestions?

Thanks,

Jean

Travis Smith

unread,
May 18, 2013, 4:48:06 PM5/18/13
to masstrans...@googlegroups.com
I take it just using hostnames is out of the question?

I feel like the easiest thing to do is create one bus per subnet. Then just have your service send messages between as needed. I don't recall speaking with anyone who has to deal with this to date, so I'm not sure I have any good guidance based upon experience. 

-Travis


--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/f13472b0-a48f-4362-b319-482faa219c6d%40googlegroups.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Chris Patterson

unread,
May 19, 2013, 12:42:16 PM5/19/13
to masstrans...@googlegroups.com
Host names would help, since each machine would resolve them to the property network.

Jean Lambert

unread,
May 21, 2013, 3:46:23 PM5/21/13
to masstrans...@googlegroups.com
Hostname did the trick for the time being.
 
We're still in the process of figuring out the best approach in cases where we have no DNS.
 
Thanks!

Jean Lambert

unread,
Jul 10, 2013, 11:23:04 AM7/10/13
to masstrans...@googlegroups.com
Here's a possible solution to this problem:
 
Reply all
Reply to author
Forward
0 new messages