I am trying to get 2 ActorSystems to communicate with each other and am having some difficulty getting both systems to use the ports specified in the application.conf files for each.
Background detail :: I am working on a distributed system written in Java/Kotlin which up till now was using a single ActorSystem in one of its web services. I am attempting to add a 2nd ActorSystem inside a different web service.
Both ActorSystems have an application.conf file specified with hostname 127.0.0.1 and ports 2553 and 2554 respectively (as I am testing the communication on a single physical device - my laptop) However, on starting the web services that create the ActorSystems both are using the default port 2552.
I have tried explicitly parsing the application.conf file and passing it in to the ActorSystem.create() but the default 2552 port is still used.
I am quite new to working on web services so apologies if I missed out any important obvious information.
So the first ActorSystem is configured like this >
akka {
event-handlers = ["akka.event.slf4j.Slf4jEventHandler"]
loggers = ["akka.event.slf4j.Slf4jLogger"]
loglevel = "INFO"
actor {
provider = remote
remote {
enabled-transports = ["akka.remote.netty.tcp"]
netty.tcp {
hostname = "127.0.0.1"
port = 2553
}
}
default-mailbox {
mailbox-type="com.nimrodtechs.nomad.baikai.actor.ConflatingQueue"
}
default-dispatcher {
executor = "thread-pool-executor"
thread-pool-executor {
# minimum number of threads to cap factor-based core number to
core-pool-size-min = 6
# No of core threads ... ceil(available processors * factor)
core-pool-size-factor = 0.5
# maximum number of threads to cap factor-based number to
core-pool-size-max = 6
allow-core-timeout = off
}
}
thread-pool-for-order-dispatcher {
# Dispatcher is the name of the event-based dispatcher
type = Dispatcher
# What kind of ExecutionService to use
executor = "thread-pool-executor"
# Configuration for the thread pool
thread-pool-executor {
# minimum number of threads to cap factor-based core number to
core-pool-size-min = 2
# No of core threads ... ceil(available processors * factor)
core-pool-size-factor = 0.5
# maximum number of threads to cap factor-based number to
core-pool-size-max = 2
allow-core-timeout = off
}
}
}
}
and my console is getting this >
2019/02/22-13:56:45.935+0000 - INFO 3255 — [main] [baikai-akka.actor.default-dispatcher-6] akka.remote.Remoting : Starting remoting
2019/02/22-13:56:45.998+0000 - INFO 3255 — [main] [baikai-akka.actor.default-dispatcher-7] akka.remote.Remoting : Remoting started; listening on addresses :[akka.tcp://baikai@192.168.204.57:2552]
2019/02/22-13:56:46.000+0000 - INFO 3255 — [main] [baikai-akka.actor.default-dispatcher-3] akka.remote.Remoting : Remoting now listens on addresses: [akka.tcp://baikai@192.168.204.57:2552]
The configuration for the second ActorSystem is identical except I specified port 2554
Again 2552 is chosen for reasons unknown to me.
The console for that service gives this >
2019/02/22-14:11:57.490+0000 -ERROR 3284 — [trader-router-akka.actor.default-dispatcher-2] a.remote.transport.netty.NettyTransport : failed to bind to /192.168.204.57:2552, shutting down Netty transport
I guess it is having trouble using port 2552 because that is already in use with the first ActorSystem.
Can anyone suggest what I might not be doing right?
So I have just seen in the Akka Doc that remoting got an upgrade at some point >
I am going to try that with the latest version of Akka (2.5.21) Previously on (2.5.9)