Skip to content

Commit

Permalink
feat: Create ClusterHttpManagementRoutes with typed actor system (#1253)
Browse files Browse the repository at this point in the history
  • Loading branch information
johanandren authored Feb 19, 2024
1 parent 0e40392 commit 9a21b4c
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import akka.cluster.sharding.{ ClusterSharding, ShardRegion }
import akka.cluster.{ Cluster, Member, MemberStatus }
import akka.http.scaladsl.model.{ HttpMethod, HttpMethods, StatusCodes, Uri }
import Uri.Path
import akka.actor.ClassicActorSystemProvider
import akka.http.scaladsl.server.Route
import akka.management.cluster._
import akka.pattern.ask
Expand Down Expand Up @@ -248,6 +249,13 @@ object ClusterHttpManagementRoutes extends ClusterHttpManagementJsonProtocol {
}
}

/**
* Creates an instance of [[ClusterHttpManagementRoutes]] to manage the cluster for the given
* typed or classic actor system instance. This version does not provide Basic Authentication.
*/
def apply(actorySystemProvider: ClassicActorSystemProvider): Route =
apply(Cluster(actorySystemProvider.classicSystem))

/**
* Creates an instance of [[ClusterHttpManagementRoutes]] to manage the specified
* [[akka.cluster.Cluster]] instance. This version does not provide Basic Authentication.
Expand Down Expand Up @@ -291,6 +299,12 @@ object ClusterHttpManagementRoutes extends ClusterHttpManagementJsonProtocol {
}
}

/**
* Creates an instance of [[ClusterHttpManagementRoutes]] with only the read only routes.
*/
def readOnly(actorySystemProvider: ClassicActorSystemProvider): Route =
readOnly(Cluster(actorySystemProvider.classicSystem))

/**
* Creates an instance of [[ClusterHttpManagementRoutes]] with only the read only routes.
*/
Expand Down

0 comments on commit 9a21b4c

Please sign in to comment.