-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2e22530
commit 10f2e85
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
src/main/kotlin/com/hero/alignlab/domain/health/resource/HealthRsocket.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.hero.alignlab.domain.health.resource | ||
|
||
import com.hero.alignlab.common.model.Response | ||
import com.hero.alignlab.domain.health.model.response.HealthResponse | ||
import io.github.oshai.kotlinlogging.KotlinLogging | ||
import org.springframework.core.env.Environment | ||
import org.springframework.messaging.handler.annotation.MessageMapping | ||
import org.springframework.stereotype.Controller | ||
|
||
@Controller | ||
class HealthRsocket( | ||
private val environment: Environment | ||
) { | ||
private val logger = KotlinLogging.logger {} | ||
|
||
@MessageMapping("rs.health") | ||
suspend fun healthSocket(): Response<HealthResponse> { | ||
logger.debug { "rsocket health check" } | ||
return environment.activeProfiles.first() | ||
.run { HealthResponse.from(this) } | ||
.run { Response(this) } | ||
} | ||
} |