Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
package org.apache.pekko.management

import org.apache.pekko
import pekko.actor.ExtendedActorSystem
import pekko.actor.{ ActorSystem, ClassicActorSystemProvider, ExtendedActorSystem, ExtensionId, ExtensionIdProvider }
import pekko.annotation.InternalApi
import pekko.http.scaladsl.model._
import pekko.http.scaladsl.server.Directives._
Expand Down Expand Up @@ -47,7 +47,12 @@ private[pekko] class HealthCheckRoutes(system: ExtendedActorSystem) extends Mana
StatusCodes.InternalServerError -> s"Health Check Failed: ${t.getMessage}")
}

override def routes(mrps: ManagementRouteProviderSettings): Route = {
override def routes(mrps: ManagementRouteProviderSettings): Route = routes()

// overload method, so user can get the routes without have to unnecessarily provide the
// settings

def routes(): Route = {
concat(
path(PathMatchers.separateOnSlashes(settings.startupPath)) {
get {
Expand All @@ -66,3 +71,16 @@ private[pekko] class HealthCheckRoutes(system: ExtendedActorSystem) extends Mana
})
}
}

/**
* Providing an extension, so users can get the routes and add it to their own server
*/
object HealthCheckRoutes extends ExtensionId[HealthCheckRoutes] with ExtensionIdProvider {
override def get(system: ActorSystem): HealthCheckRoutes = super.get(system)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

returning it here means HealthCheckRoutes is becoming public API, so we should remove the 'internal' markers.


override def get(system: ClassicActorSystemProvider): HealthCheckRoutes = super.get(system)

override def lookup: HealthCheckRoutes.type = HealthCheckRoutes

override def createExtension(system: ExtendedActorSystem): HealthCheckRoutes = new HealthCheckRoutes(system)
}