Redis Health Checker (Lettus) adapter

Table of contents

Provides adapters that enable Redis(External sites) health checks. See Health Check Endpoint Handler for health checks.

You can add health checks by creating a class that inherits from HealthChecker , described in Add a health check . The adapter offers RedisHealthChecker , a successor to HealthChecker.

Perform a redis health check

Redis health checks can be implemented by specifying RedisHealthChecker in the healthCheckers property of the HealthCheckEndpointHandler.

An example configuration is shown below.

<!-- Health Check Endpoint Handler -->
<component class="nablarch.fw.web.handler.HealthCheckEndpointHandler">
  <!-- The healthCheckers property is specified in a list -->
  <property name="healthCheckers">
    <list>
      <!-- Redis Health Check -->
      <component class="nablarch.integration.health.RedisHealthChecker">
        <!-- Specifies the Redis client (LettuceRedisClient) -->
        <property name="client" ref="lettuceRedisClient" />
      </component>
    </list>
  </property>
</component>

The RedisHealthChecker uses the LettuceRedisClient to check for the existence of the key and judge the health check to be successful if no exception is thrown. The key need not exist. For LettuceRedisClient, refer to the Client classes prepared per composition . If want to change the key, specify it in the key property of RedisHealthChecker.

<!-- Redis Health Check -->
<component class="nablarch.integration.health.RedisHealthChecker">
  <!-- Specifies the Redis client (LettuceRedisClient) -->
  <property name="client" ref="lettuceRedisClient" />
  <!-- Specify Key -->
  <property name="key" ref="pingtest" />
</component>