Interface TenantNameResolver


public interface TenantNameResolver
Resolve tenant ID class representation to Apache Pulsar tenant name (as String). Tenant identifiers in Micronaut are represented as Serializable but Apache Pulsar topic needs to know the ID of the tenant in text form thus requirement for a String.
Since:
1.2.0
Author:
Haris
  • Method Details

    • resolveTenantNameFromId

      String resolveTenantNameFromId(Serializable tenantId)
      Resolve tenant name as String from Serializable.
      Parameters:
      tenantId - Tenant ID resolved from Micronaut TenantResolver
      Returns:
      String representation of tenant name for Apache Pulsar.
    • overrideTenantName

      void overrideTenantName(String tenantName)
      Enforce usage of tenant name.
      Parameters:
      tenantName - tenant name to enforce on next calls
    • clearTenantName

      void clearTenantName()
      Clear out enforced tenant name set through overrideTenantName(String).
    • getCurrentTenantName

      String getCurrentTenantName() throws io.micronaut.multitenancy.exceptions.TenantNotFoundException
      Resolve current tenant name from tenant ID or overridden value set through overrideTenantName(String).
      Returns:
      name resolved from current tenant ID if name is not overridden; otherwise value set overrideTenantName(String).
      Throws:
      io.micronaut.multitenancy.exceptions.TenantNotFoundException - when override value is missing and no request context is available
    • hasTenantName

      boolean hasTenantName()
      Check whether tenant name exists in the current request context or is enforced.
      Returns:
      true if tenant name was set explicitly or available in TenantResolver otherwise false
    • isStaticTenantResolver

      boolean isStaticTenantResolver()
      Returns:
      Whether tenant name will be resolved only once throughout application lifetime
    • isValidTenantName

      static boolean isValidTenantName(String tenant)