Package io.micronaut.pulsar.processor
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 Summary
Modifier and TypeMethodDescriptionvoid
Clear out enforced tenant name set throughoverrideTenantName(String)
.Resolve current tenant name from tenant ID or overridden value set throughoverrideTenantName(String)
.boolean
Check whether tenant name exists in the current request context or is enforced.boolean
static boolean
isValidTenantName
(String tenant) void
overrideTenantName
(String tenantName) Enforce usage of tenant name.resolveTenantNameFromId
(Serializable tenantId) Resolve tenant name asString
fromSerializable
.
-
Method Details
-
resolveTenantNameFromId
Resolve tenant name asString
fromSerializable
.- Parameters:
tenantId
- Tenant ID resolved from MicronautTenantResolver
- Returns:
- String representation of tenant name for Apache Pulsar.
-
overrideTenantName
Enforce usage of tenant name.- Parameters:
tenantName
- tenant name to enforce on next calls
-
clearTenantName
void clearTenantName()Clear out enforced tenant name set throughoverrideTenantName(String)
. -
getCurrentTenantName
Resolve current tenant name from tenant ID or overridden value set throughoverrideTenantName(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
-