Skip to content

Commit

Permalink
fix: rsocket health check
Browse files Browse the repository at this point in the history
  • Loading branch information
DongGeon0908 committed Jul 20, 2024
1 parent 2e22530 commit 10f2e85
Showing 1 changed file with 23 additions and 0 deletions.
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) }
}
}

0 comments on commit 10f2e85

Please sign in to comment.