Use Akka management with typed Cluster

Hello, everyone.

I have a question in regard of using Akka typed cluster with akka-management libs.

Context

We have our actors defined as typed so we use akka.cluster.typed.Cluster in our code. Recently we have decided to add a bit of visibility to our cluster - metrics, logging and something for getting a cluster’s current state.
For the last thing we started looking at the set of akka-management libs. In particular at akka-management-cluster-http where ClusterHttpManagementRoutes can be found. That logic creates http routes for getting info and controlling a cluster. But right after we faced with a problem. ClusterHttpManagementRoutes is made around akka.cluster.Cluster instead of a typed version of it.

Question

So my questions are next:

  • What is a proper way of using akka-management-cluster-http and ClusterHttpManagementRoutes with akka.cluster.typed.Cluster?
  • Is there a built-in way of converting a typed Cluster into a classic one?
  • Maybe there is something else that can be used for gathering and showing info about a cluster’s state for akka.cluster.typed.Cluster?

P.S.
I try to google that problem and checked Akka’s source code with no success.

What is the error/problem that you are seeing?

akka.cluster.typed.Cluster is using (delegating) to akka.cluster.Cluster so Akka Management should give same insights for typed.Cluster.

ClusterHttpManagementRoutes.apply(..)(github) expects to receive akka.cluster.Cluster as a parameter but in our code we have only akka.cluster.typed.Cluster. These two classes are not interchangeable. And so far I’ve found no other way of using ClusterHttpManagementRoutes with akka.cluster.typed.Cluster.

// here `akka.cluster.Cluster` is used
ClusterHttpManagementRoutes.apply(cluster: Cluster) = ...

I see. That can be confusing and inconvenient. You can use it with:

ClusterHttpManagementRoutes.apply(akka.cluster.Cluster(system.classicSystem))

given that system is an akka.actor.typed.ActorSystem

It’s the same Cluster underneath.

1 Like

I’ve PR:ed a small improvement accepting a typed actor system in feat: Create ClusterHttpManagementRoutes with typed actor system by johanandren · Pull Request #1253 · akka/akka-management · GitHub

1 Like