Reputation: 158
I am developing an application to run as a command line tool, and I am using Scala/Akka. I would like for this command line tool to use a client/server architecture. When the first instance of this tool is launched, it launches an instance of a server in the background that actually does all of the processing. If a user then opens multiple terminal windows and launches more instances of this app, it will connect to the existing server rather than launch a new one. Basically I need multiple clients talking to a single server. Can this be accomplished with Akka's remoting, or do I need to run a more classic client/server architecture with a message broker in there somewhere?
Upvotes: 1
Views: 465
Reputation: 24047
Yes, it can be done with Akka remoting.
You'll want to configure the "server" ActorSystem
with a well-known port. Then use system.actorFor
in the clients to get an ActorRef
to an actor running on the server.
Make sure the hostname that you use in the config is the same hostname that you use in the path that you use in actorFor
.
Upvotes: 1