Class StaticTenantConnectPredicate

java.lang.Object
io.axoniq.framework.messaging.multitenancy.configuration.StaticTenantConnectPredicate
All Implemented Interfaces:
TenantConnectPredicate, Predicate<TenantDescriptor>

public class StaticTenantConnectPredicate extends Object implements TenantConnectPredicate
A TenantConnectPredicate that accepts a fixed set of tenant identifiers.

Applications using the Configuration API load their configuration properties themselves and pass the property's comma-separated value to from(String) when registering an instance as the TenantConnectPredicate component.

Since:
5.4.0
Author:
Jan Galinski
  • Field Details

    • TENANTS_PROPERTY

      public static final String TENANTS_PROPERTY
      The property containing a comma-separated list of tenant identifiers.
      See Also:
  • Constructor Details

    • StaticTenantConnectPredicate

      public StaticTenantConnectPredicate(Set<String> tenants)
      Creates a predicate accepting the given tenant identifiers.
      Parameters:
      tenants - the tenant identifiers to accept
  • Method Details

    • from

      public static StaticTenantConnectPredicate from(String tenantsCsv)
      Creates a predicate from a comma-separated list of tenant identifiers.

      Whitespace around an identifier and empty entries are ignored.

      Parameters:
      tenantsCsv - the comma-separated tenant identifiers
      Returns:
      a predicate accepting the tenant identifiers in tenantsCsv
    • test

      public boolean test(TenantDescriptor tenantDescriptor)
      Tests whether the tenant identifier is in this predicate's fixed set.
      Specified by:
      test in interface Predicate<TenantDescriptor>
      Parameters:
      tenantDescriptor - the tenant to test
      Returns:
      true when the tenant identifier is configured