Alexander Chepurnoy
Alexander Chepurnoy

Reputation: 615

Disconnect in Akka Remoting?

I want to drop connection with a remote side using Akka Remoting. I've found only information about impossibility of it in the Web. Is any trick to drop a connection though?

Upvotes: 1

Views: 181

Answers (1)

johanandren
johanandren

Reputation: 11479

Since akka remoting is peer-to-peer, if not connected either side can start a connection it isn't really about dropping one connection but to remove the possibility to talk to another system. The only two ways I can think of are (neither especially smooth):

  1. only allow communication through an actor that will decide if incoming messages from other systems are dropped or allowed. This will not really drop the tcp connection, but disallow incoming messages.

  2. Use a separate actor system for the remoting connection, and shut that down. This will effectively kill communication, but if you intend to communicate with many remotes it might be too much overhead

If it is one connection coming in from another system, like a client-server scenario it might be better to use some other way of communication, a custom protocol on top of tcp or some other higher level protocol such as http.

Upvotes: 1

Related Questions