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();
}
When sending a message to B for example, I do something like:
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.
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