Case:
I have two services (A and B) that wish to talk to each other using akka-remoting over artery.
Each service executes on it's own machine behind a load balancer mapping a dns name, e.g. $A resolving -> multiple IP addresses.
For A to talk to B, we can for example execute:
// Make request from an A to a B
val b = context.actorSelection(s"akka://$systemName@$B:$port/user/$actorName")
b ! Request()
where $B is the load balanced address that is resolved to a B instance (maybe B1, maybe B2.. etc)
In order for B to receive this message, B would need to have an akka conf with canonical.hostname = $B. Otherwise artery will filter out these messages...
So far, this works. However, now let's say this is bidirectional communication.
B wants to reply to A's requests, but also, B wants to send its own independent requests to A and expect A to reply back to B.
B would then have something like the following code
// Reply from B back to A
def receive {
case Request() => sender() ! Reply()
}
But because A has canonical.hostname set to $A, which is a load balanced address, the reply could end up at A1, A2 or any Ai for that matter.
To work around this, all I can think of is to let each actor resolution actually do a manual dns lookup before calling context.actorSelection.. and write the explicit resolved address of each actor to their own akka conf.
Is this conclusion correct?
I suspect akka.tcp does not have this problem as sender() would just re-use the existing tcp connection, but artery being build on udp, will suffer from the problem above.
Am I missing something? :)
/ Johan