Class TenantComponentParameterResolverFactory
- All Implemented Interfaces:
ParameterResolverFactory
ParameterResolverFactory injecting tenant-scoped components into message-handling methods.
For each handler parameter it looks for a registered TenantComponentProvider whose
component type fits the parameter type. When one is found, the
resolved parameter value is that provider's instance for the tenant of the message being handled. The tenant is
derived from the current ProcessingContext (see RegisterTenantDescriptorHandlerInterceptor).
Registering several providers (one per component type) is supported: each parameter is matched to the provider for
its own type. A single exact type match settles the choice, even when assignable supertype candidates exist. When the
choice cannot be settled by an exact match, handler inspection fails with an AxonConfigurationException,
since silently picking one of the candidates could hand the handler the wrong tenant-scoped resource.
- Since:
- 5.3.0
- Author:
- Theo Emanuelsson, Jan Galinski, Laura Devriendt, Jakob Hatzl
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTenantComponentParameterResolverFactory(Configuration configuration) Constructs aTenantComponentParameterResolverFactoryfor the givenconfiguration. -
Method Summary
Modifier and TypeMethodDescription@Nullable ParameterResolver<?> createInstance(Executable executable, Parameter[] parameters, int parameterIndex) If available, creates aParameterResolverinstance that can provide a parameter of typeparameterTypefor a given message.
-
Constructor Details
-
TenantComponentParameterResolverFactory
Constructs aTenantComponentParameterResolverFactoryfor the givenconfiguration.The given
configurationsupplies the registeredprovidersmatched against handler parameters. The tenant itself is read from theProcessingContextof the message being handled.- Parameters:
configuration- the configuration to look up the registered tenant-component providers, must not benull
-
-
Method Details
-
createInstance
public @Nullable ParameterResolver<?> createInstance(Executable executable, Parameter[] parameters, int parameterIndex) Description copied from interface:ParameterResolverFactoryIf available, creates aParameterResolverinstance that can provide a parameter of typeparameterTypefor a given message.If the
ParameterResolverFactorycannot provide a suitableParameterResolver, returnsnull.- Specified by:
createInstancein interfaceParameterResolverFactory- Parameters:
executable- The executable (constructor or method) to inspect.parameters- The parameters on the executable to inspect.parameterIndex- The index of the parameter to return aParameterResolverfor.- Returns:
- A suitable
ParameterResolver, ornullif none is found.
-