Module bus.starter

Class HealthController

java.lang.Object
org.miaixz.bus.core.basic.spring.Controller
org.miaixz.bus.starter.health.HealthController

public class HealthController extends org.miaixz.bus.core.basic.spring.Controller
健康检查
Since:
Java 17+
Author:
Kimi Liu
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    构造函数,注入 HealthProviderService。
  • Method Summary

    Modifier and Type
    Method
    Description
    将就绪状态改为 ACCEPTING_TRAFFIC,Kubernetes 将请求转发到此 pod。
    将存活状态改为 BROKEN,导致 Kubernetes 杀死并重启 pod。
    将存活状态改为 CORRECT,表示 pod 正常运行。
    获取系统健康状态信息
    将就绪状态改为 REFUSING_TRAFFIC,Kubernetes 拒绝外部请求。

    Methods inherited from class org.miaixz.bus.core.basic.spring.Controller

    write, write, write, write, write, write, write, write

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • HealthController

      public HealthController(HealthService service)
      构造函数,注入 HealthProviderService。
      Parameters:
      service - 健康状态服务
  • Method Details

    • healthz

      @ResponseBody @RequestMapping(value="/healthz", method={POST,GET}) public Object healthz(@RequestParam(value="tid",required=false) String tid)
      获取系统健康状态信息
      Parameters:
      tid - 参数
      Returns:
      操作结果
    • broken

      @ResponseBody @RequestMapping(value="/broken", method={POST,GET}) public Object broken()
      将存活状态改为 BROKEN,导致 Kubernetes 杀死并重启 pod。
      Returns:
      操作结果
    • correct

      @ResponseBody @RequestMapping(value="/correct", method={POST,GET}) public Object correct()
      将存活状态改为 CORRECT,表示 pod 正常运行。
      Returns:
      操作结果
    • accept

      @ResponseBody @RequestMapping(value="/accept", method={POST,GET}) public Object accept()
      将就绪状态改为 ACCEPTING_TRAFFIC,Kubernetes 将请求转发到此 pod。
      Returns:
      操作结果
    • refuse

      @ResponseBody @RequestMapping(value="/refuse", method={POST,GET}) public Object refuse()
      将就绪状态改为 REFUSING_TRAFFIC,Kubernetes 拒绝外部请求。
      Returns:
      操作结果