Hi. I am evaluating Akka. My use case is roughly as follows:
I work for an (fairly major) airline. We are replacing an internal system with a new system written to run in AWS. Some of my other developers been using in some other limited scopes and have found it a good fit for those use cases. Once I started digging into Akka I could see it is a natural fit for what I want to do, which is track flight state on the day of operation.
We are planning on having an Actor instance created per-flight which keeps track of where the flight is in terms of its operation (e.g. aircraft assigned, inbound flight has arrived at the gate, checkin is open, boarding has started, departed, airborne, arrived at destination, cancelled, delayed, and so on).
So far, I’ve just started coding up a simple two Actor system (after stepping through the tutorials) and within a day or so I’ve got a bunch unit tests trying to find my corner cases – all of which has been an excellent experience so far. However I realised early on that we will have to use Akka-cluster (and persistence) and I wanted to find out if this was going to be a show-stopper for us, or not, before we got too deep into building the rest of the system logic (which is deeply complex).
I started to add the clustering code in my unit tests to see how easy it was to deal with. Obviously for this test I just elected to use bootstrap and clustering with a configuration file. While I can see the bootstrap and management start up in the pre-start stage, the cluster always reports in the logs that is can’t find the seed nodes:
[INFO] [03/20/2019 17:36:14.927] [ao-fl-event-processor-akka.actor.default-dispatcher-3] [akka.cluster.Cluster(ak ka:/ /ao-fl-event-processor)] Cluster Node [ak ka.tcp:/ /ao-fl-event-processor@172.31.227.65:2552] - No seed-nodes configured, manual cluster join required, see htt ps:/ /doc.akka.io/docs/akka/current/cluster-usage.html#joining-to-seed-nodes
(I had to insert some extraneous spaces here because the forum was complaining I’m only allows to post “2 links”)
Is this something I need to worry about, i.e. my cluster config is broken, or is this just something the cluster will do, given I’ve not got seed-nodes configured, and the bootstrap process will take over after it complains?
This is the top of my JUnit test class, where I’m initialising the actor system and cluster:
public class FlightActorTest {
static ActorSystem system;
static Cluster cluster;
@BeforeClass
public static void setup() {
system = ActorSystem.create("ao-fl-event-processor");
// Akka Management hosts the HTTP routes used by bootstrap
AkkaManagement.get(system).start();
// Starting the bootstrap process needs to be done explicitly
ClusterBootstrap.get(system).start();
cluster = Cluster.get(system);
system.log().info("cluster address on {} ", cluster.selfAddress());
system.log().info("System is named {}", system.name());
}
// omitted ...
}
I am using the config method as bootstrap recommended without specifying any seed-nodes:
akka {
actor {
provider = "cluster"
}
}
akka.cluster {
shutdown-after-unsuccessful-join-seed-nodes = 30s
}
akka.coordinated-shutdown.exit-jvm = off # MUST BE 'ON' IN PRODUCTION
# Enable metrics extension in akka-cluster-metrics.
# akka.extensions=["akka.cluster.metrics.ClusterMetricsExtension"]
# Sigar native library extract location during tests.
# Note: use per-jvm-instance folder when running multiple jvm on one host.
# akka.cluster.metrics.native-library-extract-folder=${user.dir}/target/native
akka.discovery {
config.services = {
ao-fl-event-processor = {
endpoints = [
{
host = "127.0.0.1"
port = 8558
},
{
host = "127.0.0.1"
port = 8559
},
{
host = "127.0.0.1"
port = 8557
}
]
}
}
}
akka.management {
# registers bootstrap routes to be included in akka-management's http endpoint
http.routes {
cluster-bootstrap = "akka.management.cluster.bootstrap.ClusterBootstrap$"
}
cluster.bootstrap {
contact-point-discovery {
service-name = "ao-fl-event-processor"
discovery-method = config
}
join-decider {
# Implementation of JoinDecider.
# It must extend akka.management.cluster.bootstrap.JoinDecider and
# have public constructor with ActorSystem and ClusterBootstrapSettings
# parameters.
class = "akka.management.cluster.bootstrap.LowestAddressJoinDecider"
}
}
}
Here’s the full log output, up to the first test where it’s logging something from the Actor.
[INFO] [03/20/2019 17:36:14.222] [main] [akka.remote.Remoting] Starting remoting
[INFO] [03/20/2019 17:36:14.742] [main] [akka.remote.Remoting] Remoting started; listening on addresses :[akka.tcp:/ /ao-fl-event-processor@172.31.227.65:2552]
[INFO] [03/20/2019 17:36:14.745] [main] [akka.remote.Remoting] Remoting now listens on addresses: [akka.tcp:/ /ao-fl-event-processor@172.31.227.65:2552]
[INFO] [03/20/2019 17:36:14.775] [main] [akka.cluster.Cluster(akka:/ /ao-fl-event-processor)] Cluster Node [akka.tcp:/ /ao-fl-event-processor@172.31.227.65:2552] - Starting up, Akka version [2.5.21] …
[INFO] [03/20/2019 17:36:14.893] [main] [akka.cluster.Cluster(akka:/ /ao-fl-event-processor)] Cluster Node [akka.tcp:/ /ao-fl-event-processor@172.31.227.65:2552] - Registered cluster JMX MBean [akka:type=Cluster]
[INFO] [03/20/2019 17:36:14.893] [main] [akka.cluster.Cluster(akka:/ /ao-fl-event-processor)] Cluster Node [akka.tcp:/ /ao-fl-event-processor@172.31.227.65:2552] - Started up successfully
[INFO] [03/20/2019 17:36:14.927] [ao-fl-event-processor-akka.actor.default-dispatcher-3] [akka.cluster.Cluster(akka:/ /ao-fl-event-processor)] Cluster Node [akka.tcp:/ /ao-fl-event-processor@172.31.227.65:2552] - No seed-nodes configured, manual cluster join required, see https:/ /doc.akka.io/docs/akka/current/cluster-usage.html#joining-to-seed-nodes
[INFO] [03/20/2019 17:36:15.068] [main] [ClusterBootstrap(akka:/ /ao-fl-event-processor)] Bootstrap usingakka.discovery
method: config
[INFO] [03/20/2019 17:36:15.093] [main] [HealthChecksImpl(akka:/ /ao-fl-event-processor)] Loading readiness checks List()
[INFO] [03/20/2019 17:36:15.093] [main] [HealthChecksImpl(akka:/ /ao-fl-event-processor)] Loading liveness checks List()
[INFO] [03/20/2019 17:36:15.255] [main] [AkkaManagement(akka:/ /ao-fl-event-processor)] Binding Akka Management (HTTP) endpoint to: 172.31.227.65:8558
[INFO] [03/20/2019 17:36:15.387] [main] [AkkaManagement(akka:/ /ao-fl-event-processor)] Including HTTP management routes for ClusterBootstrap
[INFO] [03/20/2019 17:36:15.394] [main] [ClusterBootstrap(akka:/ /ao-fl-event-processor)] Using self contact point address: http://172.31.227.65:8558
[INFO] [03/20/2019 17:36:15.453] [main] [AkkaManagement(akka:/ /ao-fl-event-processor)] Including HTTP management routes for HealthCheckRoutes
[INFO] [03/20/2019 17:36:16.361] [main] [ClusterBootstrap(akka:/ /ao-fl-event-processor)] Initiating bootstrap procedure using config method…
[INFO] [03/20/2019 17:36:16.366] [main] [akka.actor.ActorSystemImpl(ao-fl-event-processor)] cluster address on akka.tcp:/ /ao-fl-event-processor@172.31.227.65:2552
[INFO] [03/20/2019 17:36:16.366] [main] [akka.actor.ActorSystemImpl(ao-fl-event-processor)] System is named ao-fl-event-processor
[INFO] [03/20/2019 17:36:16.383] [ao-fl-event-processor-akka.actor.default-dispatcher-15] [akka.tcp:/ /ao-fl-event-processor@172.31.227.65:2552/system/bootstrapCoordinator] Locating service members. Using discovery [akka.discovery.config.ConfigServiceDiscovery], join decider [akka.management.cluster.bootstrap.LowestAddressJoinDecider]
[INFO] [03/20/2019 17:36:16.384] [ao-fl-event-processor-akka.actor.default-dispatcher-15] [akka.tcp:/ /ao-fl-event-processor@172.31.227.65:2552/system/bootstrapCoordinator] Looking up [Lookup(ao-fl-event-processor,None,Some(tcp))]
[INFO] [03/20/2019 17:36:16.391] [ao-fl-event-processor-akka.actor.default-dispatcher-15] [akka.tcp:/ /ao-fl-event-processor@172.31.227.65:2552/system/bootstrapCoordinator] Located service members based on: [Lookup(ao-fl-event-processor,None,Some(tcp))]: [ResolvedTarget(127.0.0.1,Some(8558),None), ResolvedTarget(127.0.0.1,Some(8559),None), ResolvedTarget(127.0.0.1,Some(8557),None)], filtered to [ResolvedTarget(127.0.0.1,Some(8558),None)]
[INFO] [03/20/2019 17:36:16.396] [ao-fl-event-processor-akka.actor.default-dispatcher-17] [AkkaManagement(akka:/ /ao-fl-event-processor)] Bound Akka Management (HTTP) endpoint to: 172.31.227.65:8558
[INFO] [03/20/2019 17:36:16.431] [ao-fl-event-processor-akka.actor.default-dispatcher-17] [akka:/ /ao-fl-event-processor/user/XX456-2019-03-19] Flight actor XX456/2019-03-19 started
[INFO] [03/20/2019 17:36:16.446] [ao-fl-event-processor-akka.actor.default-dispatcher-17] [akka:/ /ao-fl-event-processor/user/XX456-2019-03-19] Flight actor XX456/2019-03-19 received equipment update VHXXX in msg 17a6285a-117c-46a6-af2d-7ccca7935b1f from akka:/ /ao-fl-event-processor/system/testProbe-1