Class TenantDescriptor

java.lang.Object
io.axoniq.framework.messaging.multitenancy.api.TenantDescriptor

public class TenantDescriptor extends Object
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 Details

  • Constructor Details

    • TenantDescriptor

      public TenantDescriptor(String tenantId, Map<String,String> properties)
      Creates a new TenantDescriptor with the given tenantId and properties.
      Parameters:
      tenantId - the identifier of this TenantDescriptor
      properties - the (empty) properties of this tenant, usually provider specific properties that can be used for tenant resolution
    • TenantDescriptor

      public TenantDescriptor(String tenantId)
      Constructs a TenantDescriptor with the given tenantId.
      Parameters:
      tenantId - the identifier of this TenantDescriptor
  • Method Details

    • tenantWithId

      public static TenantDescriptor tenantWithId(String tenantId)
      Constructs a TenantDescriptor with the given tenantId.
      Parameters:
      tenantId - the identifier of this TenantDescriptor
      Returns:
      a TenantDescriptor with the given tenantId
    • fromContext

      public static Optional<TenantDescriptor> fromContext(ProcessingContext context)
      Returns an Optional of the TenantDescriptor kept under the RESOURCE_KEY in the given context, or Optional.empty() when none is present.
      Parameters:
      context - the ProcessingContext to retrieve the TenantDescriptor from, if present
      Returns:
      an Optional of the TenantDescriptor kept under the RESOURCE_KEY in the given context
    • tenantId

      public String tenantId()
      Returns the identifier of this TenantDescriptor.
      Returns:
      the identifier of this TenantDescriptor
    • properties

      public Map<String,String> properties()
      Returns the properties of this TenantDescriptor.
      Returns:
      the properties of this TenantDescriptor
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object