Class HealthResult

java.lang.Object
org.acemq.rabbitmq.admin.HealthResult

public final class HealthResult extends Object
The answer to one of the broker's own health checks.

These are worth preferring over anything inferred from metrics, because the broker is answering the question directly rather than letting you reconstruct it. Two of them — Health.quorumCritical() and Health.certificateExpiration(int, String) — cannot be derived from the metrics endpoint at all.

A failed check is not an exception. The endpoint answers HTTP 503 when the thing it checks is unhealthy, which is the check working correctly; turning that into a thrown exception would make "is the broker healthy?" impossible to answer with "no".

  • Method Details

    • check

      public String check()
      Returns:
      which check this was, as its path segment, for example alarms
    • isOk

      public boolean isOk()
      Returns:
      whether the broker reported this check as passing
    • reason

      public Optional<String> reason()
      Returns:
      why it failed, when it failed. Empty when the check passed — RabbitMQ sends no reason for a pass, and inventing one here would be words this library made up
    • details

      public Map<String,Object> details()
      Returns:
      everything else the check returned, unmodelled. alarms carries an alarms array naming the node and resource; the certificate check carries the expiring certificates. These differ per check and are passed through rather than flattened into a shape that fits none of them
    • orThrow

      public void orThrow()
      Throws:
      AdminException - if this check failed, with the broker's own reason
    • toString

      public String toString()
      Overrides:
      toString in class Object