Class TenantDescriptor
java.lang.Object
io.axoniq.framework.messaging.multitenancy.api.TenantDescriptor
A descriptor for tenants holding the
tenantId and a Map of provider specific properties that
can be used for tenant resolution.
The identity of this class does on purpose only include the #tenantId to allow using it as map key.
- Since:
- 4.6.0
- Author:
- Stefan Dragisic, Jan Galinski
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Context.ResourceKey<TenantDescriptor> static final StringThe key under which a tenant identifier is stored in a message'smetadata. -
Constructor Summary
ConstructorsConstructorDescriptionTenantDescriptor(String tenantId) Constructs aTenantDescriptorwith the giventenantId.TenantDescriptor(String tenantId, Map<String, String> properties) Creates a newTenantDescriptorwith the giventenantIdandproperties. -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic Optional<TenantDescriptor> fromContext(ProcessingContext context) Returns anOptionalof theTenantDescriptorkept under theRESOURCE_KEYin the givencontext, orOptional.empty()when none is present.inthashCode()Returns the properties of thisTenantDescriptor.tenantId()Returns the identifier of thisTenantDescriptor.static TenantDescriptortenantWithId(String tenantId) Constructs aTenantDescriptorwith the giventenantId.toString()
-
Field Details
-
TENANT_ID_KEY
The key under which a tenant identifier is stored in a message'smetadata.- See Also:
-
RESOURCE_KEY
-
-
Constructor Details
-
TenantDescriptor
Creates a newTenantDescriptorwith the giventenantIdandproperties.- Parameters:
tenantId- the identifier of thisTenantDescriptorproperties- the (empty) properties of this tenant, usually provider specific properties that can be used for tenant resolution
-
TenantDescriptor
Constructs aTenantDescriptorwith the giventenantId.- Parameters:
tenantId- the identifier of thisTenantDescriptor
-
-
Method Details
-
tenantWithId
Constructs aTenantDescriptorwith the giventenantId.- Parameters:
tenantId- the identifier of thisTenantDescriptor- Returns:
- a
TenantDescriptorwith the giventenantId
-
fromContext
Returns anOptionalof theTenantDescriptorkept under theRESOURCE_KEYin the givencontext, orOptional.empty()when none is present.- Parameters:
context- theProcessingContextto retrieve theTenantDescriptorfrom, if present- Returns:
- an
Optionalof theTenantDescriptorkept under theRESOURCE_KEYin the givencontext
-
tenantId
Returns the identifier of thisTenantDescriptor.- Returns:
- the identifier of this
TenantDescriptor
-
properties
Returns the properties of thisTenantDescriptor.- Returns:
- the properties of this
TenantDescriptor
-
equals
-
hashCode
public int hashCode() -
toString
-