Class AsyncApiControlPlaneRegistry

java.lang.Object
org.mockserver.async.AsyncApiControlPlaneRegistry

public class AsyncApiControlPlaneRegistry extends Object
Process-wide holder for the optional AsyncApiControlPlane implementation.

Lives in mockserver-core so that HttpState can call it without a compile-time dependency on mockserver-async. When no implementation is registered (the module is not on the classpath), the load() and status() methods return a "not available" JSON response — the endpoint is still routable but responds with 501/503 semantics, same as other optional features.

Thread safety: register(AsyncApiControlPlane) is called once at startup; reads are safe after that. The volatile field ensures visibility across threads.

  • Method Details

    • getInstance

      public static AsyncApiControlPlaneRegistry getInstance()
    • register

      public void register(AsyncApiControlPlane controlPlane)
      Register the control-plane implementation. Called once at server startup by the mockserver-async module's bootstrap code.
    • isAvailable

      public boolean isAvailable()
      Returns:
      true if an implementation is registered (mockserver-async is on the classpath)
    • load

      public com.fasterxml.jackson.databind.JsonNode load(String requestBody)
      Delegate to the registered implementation, or return a "not available" response.
    • status

      public com.fasterxml.jackson.databind.JsonNode status()
      Delegate to the registered implementation, or return a "not available" response.
    • reset

      public void reset()
      Reset async mocking state. Safe to call even when no implementation is registered.
    • verify

      public String verify(String verificationJson)
      Delegate verify to the registered implementation, or return a not-available message.
      Returns:
      null if verification passes; a failure description if it fails; a not-available message if no implementation is registered