Class DefaultFluxzero.Builder
- All Implemented Interfaces:
FluxzeroBuilder, FluxzeroConfiguration
- Enclosing class:
DefaultFluxzero
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddBatchInterceptor(BatchInterceptor interceptor, MessageType... forTypes) Registers aBatchInterceptorthat applies to the given message types.addConsumerConfiguration(@NonNull ConsumerConfiguration configuration, MessageType... messageTypes) Adds a specific consumer configuration for one or more message types.addDispatchInterceptor(@NonNull DispatchInterceptor interceptor, MessageType... forTypes) Adds aDispatchInterceptorthat modifies or monitors message dispatch.addHandlerDecorator(@NonNull HandlerDecorator interceptor, MessageType... forTypes) Adds aHandlerDecoratorfor the given message types.addParameterResolver(@NonNull ParameterResolver<? super DeserializingMessage> parameterResolver) Registers aParameterResolverto support injection of method arguments in handlers.Builds the Fluxzero instance using the provided low-levelClient.cache()Default cache used for internal stateful optimizations (e.g. handler state, snapshots).configureDefaultConsumer(@NonNull MessageType messageType, @NonNull UnaryOperator<ConsumerConfiguration> updateFunction) Update the default consumer configuration for the specified message type.protected GenericGatewaycreateRequestGateway(Client client, MessageType messageType, String topic, RequestHandler requestHandler, Map<MessageType, DispatchInterceptor> dispatchInterceptors, Map<MessageType, HandlerDecorator> handlerDecorators, List<ParameterResolver<? super DeserializingMessage>> parameterResolvers, Function<Class<?>, HandlerRepository> handlerRepositorySupplier, RepositoryProvider repositoryProvider, ResponseMapper responseMapper) Disables support for dynamically injected dispatch interceptors.Disables automatic caching of aggregates.Disables metrics related to cache eviction.Disables security filtering based on@FilterContent.Disables automatic error reporting (e.g., viaErrorGateway).Disables Fluxzero’s built-in keepalive mechanism.Disables automatic message correlation.Disables payload validation.Prevents installation of the default scheduled command handler.Prevents registration of a shutdown hook.Disables tracking of processing metrics.Disables validation of injected web parameters (e.g.Disables compression for web responses.protected FluxzerodoBuild(Map<MessageType, ? extends Tracking> trackingSupplier, Function<String, ? extends GenericGateway> customGatewaySupplier, CommandGateway commandGateway, QueryGateway queryGateway, EventGateway eventGateway, ResultGateway resultGateway, ErrorGateway errorGateway, MetricsGateway metricsGateway, WebRequestGateway webRequestGateway, AggregateRepository aggregateRepository, SnapshotStore snapshotStore, EventStore eventStore, KeyValueStore keyValueStore, DocumentStore documentStore, MessageScheduler messageScheduler, UserProvider userProvider, Cache cache, Serializer serializer, CorrelationDataProvider correlationDataProvider, IdentityProvider identityProvider, PropertySource propertySource, DelegatingClock clock, TaskScheduler taskScheduler, Client client, ThrowingRunnable shutdownHandler) enableHostMetrics(HostMetricsConfiguration configuration) Enables host metrics collection with a custom configuration.forwardWebRequestsToLocalServer(LocalServerConfig localServerConfig, UnaryOperator<ConsumerConfiguration> consumerConfigurator) Configures forwarding ofMessageType.WEBREQUESTmessages to a local HTTP server using the specifiedLocalServerConfigand custom consumer configuration.protected ConsumerConfigurationgetDefaultConsumerConfiguration(MessageType messageType) protected HandlerRegistrylocalHandlerRegistry(MessageType messageType, Map<MessageType, HandlerDecorator> handlerDecorators, List<ParameterResolver<? super DeserializingMessage>> parameterResolvers, Map<MessageType, DispatchInterceptor> dispatchInterceptors, Function<Class<?>, HandlerRepository> handlerRepositorySupplier, RepositoryProvider repositoryProvider) makeApplicationInstance(boolean makeApplicationInstance) Marks the built instance as the global (application-level)Fluxzero.protected MethodInvocationValidator<? super DeserializingMessage> methodInvocationValidator(MessageType messageType) registerUserProvider(UserProvider userProvider) Registers a user provider used for resolving and authenticatingUserinstances.Dedicated cache used to store and lookup relationships between entities.replaceCache(@NonNull Cache cache) Replaces the default cache implementation.replaceCorrelationDataProvider(@NonNull UnaryOperator<CorrelationDataProvider> replaceFunction) Replaces theCorrelationDataProviderused to attach correlation data to messages.replaceDefaultResponseMapper(ResponseMapper defaultResponseMapper) Replaces the default response mapper used for generic result mapping.replaceDocumentSerializer(@NonNull DocumentSerializer documentSerializer) Replaces the document serializer for search indexing.replaceIdentityProvider(UnaryOperator<IdentityProvider> replaceFunction) Replaces the identity provider used to generate message and entity identifiers.replaceMessageRoutingInterceptor(@NonNull DispatchInterceptor messageRoutingInterceptor) Replaces the default routing interceptor used for message dispatch.replacePropertySource(UnaryOperator<PropertySource> replacer) Replaces the existing property source.replaceRelationshipsCache(UnaryOperator<Cache> replaceFunction) Replaces the internal relationships cache with a new implementation.replaceSerializer(@NonNull Serializer serializer) Replaces the default serializer used for events, commands, snapshots, and documents.replaceSnapshotSerializer(@NonNull Serializer serializer) Overrides the serializer used specifically for snapshot serialization.replaceTaskScheduler(Function<Clock, TaskScheduler> function) Replaces the defaultTaskSchedulerimplementation.replaceWebResponseMapper(WebResponseMapper webResponseMapper) Replaces theWebResponseMapperused for handling web responses.withAggregateCache(Class<?> aggregateType, Cache cache) Configures a dedicated cache for a specific aggregate type.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface FluxzeroBuilder
addHandlerInterceptor, addPropertySource, disableAutomaticTracking, enableHostMetrics, enableHostMetrics, forwardWebRequestsToLocalServerMethods inherited from interface FluxzeroConfiguration
batchInterceptors, clock, correlationDataProvider, customConsumerConfigurations, defaultConsumerConfigurations, defaultResponseMapper, dispatchInterceptors, documentSerializer, forwardingWebConsumer, handlerDecorators, identityProvider, makeApplicationInstance, messageRoutingInterceptor, parameterResolvers, propertySource, schedulingInterceptor, serializer, snapshotSerializer, taskScheduler, userProvider, webResponseMapper
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
replaceSerializer
Description copied from interface:FluxzeroBuilderReplaces the default serializer used for events, commands, snapshots, and documents.- Specified by:
replaceSerializerin interfaceFluxzeroBuilder
-
replaceCorrelationDataProvider
public FluxzeroBuilder replaceCorrelationDataProvider(@NonNull @NonNull UnaryOperator<CorrelationDataProvider> replaceFunction) Description copied from interface:FluxzeroBuilderReplaces theCorrelationDataProviderused to attach correlation data to messages.- Specified by:
replaceCorrelationDataProviderin interfaceFluxzeroBuilder
-
replaceSnapshotSerializer
Description copied from interface:FluxzeroBuilderOverrides the serializer used specifically for snapshot serialization.- Specified by:
replaceSnapshotSerializerin interfaceFluxzeroBuilder
-
replaceDocumentSerializer
public FluxzeroBuilder replaceDocumentSerializer(@NonNull @NonNull DocumentSerializer documentSerializer) Description copied from interface:FluxzeroBuilderReplaces the document serializer for search indexing.- Specified by:
replaceDocumentSerializerin interfaceFluxzeroBuilder
-
registerUserProvider
Description copied from interface:FluxzeroBuilderRegisters a user provider used for resolving and authenticatingUserinstances.- Specified by:
registerUserProviderin interfaceFluxzeroBuilder
-
replacePropertySource
Description copied from interface:FluxzeroBuilderReplaces the existing property source.- Specified by:
replacePropertySourcein interfaceFluxzeroBuilder
-
configureDefaultConsumer
public DefaultFluxzero.Builder configureDefaultConsumer(@NonNull @NonNull MessageType messageType, @NonNull @NonNull UnaryOperator<ConsumerConfiguration> updateFunction) Description copied from interface:FluxzeroBuilderUpdate the default consumer configuration for the specified message type.- Specified by:
configureDefaultConsumerin interfaceFluxzeroBuilder
-
addConsumerConfiguration
public DefaultFluxzero.Builder addConsumerConfiguration(@NonNull @NonNull ConsumerConfiguration configuration, MessageType... messageTypes) Description copied from interface:FluxzeroBuilderAdds a specific consumer configuration for one or more message types.- Specified by:
addConsumerConfigurationin interfaceFluxzeroBuilder
-
addBatchInterceptor
Description copied from interface:FluxzeroBuilderRegisters aBatchInterceptorthat applies to the given message types.You can use
@Orderon the interceptor class to influence ordering. Lower values have higher priority. Interceptors with a negative order value run before Fluxzero's built-in batch interceptors, while zero, positive, or missing values run after them. Interceptors registered via Java'sServiceLoaderare also picked up automatically and participate in the same ordering.- Specified by:
addBatchInterceptorin interfaceFluxzeroBuilder
-
addDispatchInterceptor
public DefaultFluxzero.Builder addDispatchInterceptor(@NonNull @NonNull DispatchInterceptor interceptor, MessageType... forTypes) Description copied from interface:FluxzeroBuilderAdds aDispatchInterceptorthat modifies or monitors message dispatch.You can use
@Orderon the interceptor class to influence ordering. Lower values have higher priority. Interceptors with a negative order value run in the high-priority slot, while zero, positive, or missing values run in the regular slot. Interceptors registered via Java'sServiceLoaderare also picked up automatically and participate in the same ordering.- Specified by:
addDispatchInterceptorin interfaceFluxzeroBuilder
-
addHandlerDecorator
public DefaultFluxzero.Builder addHandlerDecorator(@NonNull @NonNull HandlerDecorator interceptor, MessageType... forTypes) Description copied from interface:FluxzeroBuilderAdds aHandlerDecoratorfor the given message types.You can use
@Orderon the decorator class to influence ordering. Lower values have higher priority. Decorators with a negative order value run in the high-priority slot, while zero, positive, or missing values run in the regular slot. Decorators registered via Java'sServiceLoaderare not discovered automatically; automatic service loading applies to interceptor interfaces.- Specified by:
addHandlerDecoratorin interfaceFluxzeroBuilder
-
replaceMessageRoutingInterceptor
public DefaultFluxzero.Builder replaceMessageRoutingInterceptor(@NonNull @NonNull DispatchInterceptor messageRoutingInterceptor) Description copied from interface:FluxzeroBuilderReplaces the default routing interceptor used for message dispatch.- Specified by:
replaceMessageRoutingInterceptorin interfaceFluxzeroBuilder
-
replaceCache
Description copied from interface:FluxzeroBuilderReplaces the default cache implementation.- Specified by:
replaceCachein interfaceFluxzeroBuilder
-
forwardWebRequestsToLocalServer
public FluxzeroBuilder forwardWebRequestsToLocalServer(LocalServerConfig localServerConfig, UnaryOperator<ConsumerConfiguration> consumerConfigurator) Description copied from interface:FluxzeroBuilderConfigures forwarding ofMessageType.WEBREQUESTmessages to a local HTTP server using the specifiedLocalServerConfigand custom consumer configuration.This mechanism is useful for advanced integration scenarios but bypasses Fluxzero's pull-based message tracking. Prefer native
@HandleWebhandlers when possible.- Specified by:
forwardWebRequestsToLocalServerin interfaceFluxzeroBuilder- Parameters:
localServerConfig- configuration for the local server (e.g., port, error behavior)consumerConfigurator- function to customize the underlyingConsumerConfiguration- Returns:
- this builder instance
- See Also:
-
replaceDefaultResponseMapper
Description copied from interface:FluxzeroBuilderReplaces the default response mapper used for generic result mapping.- Specified by:
replaceDefaultResponseMapperin interfaceFluxzeroBuilder
-
replaceWebResponseMapper
Description copied from interface:FluxzeroBuilderReplaces theWebResponseMapperused for handling web responses.- Specified by:
replaceWebResponseMapperin interfaceFluxzeroBuilder
-
replaceTaskScheduler
Description copied from interface:FluxzeroBuilderReplaces the defaultTaskSchedulerimplementation.- Specified by:
replaceTaskSchedulerin interfaceFluxzeroBuilder
-
withAggregateCache
Description copied from interface:FluxzeroBuilderConfigures a dedicated cache for a specific aggregate type.- Specified by:
withAggregateCachein interfaceFluxzeroBuilder
-
replaceRelationshipsCache
Description copied from interface:FluxzeroBuilderReplaces the internal relationships cache with a new implementation.- Specified by:
replaceRelationshipsCachein interfaceFluxzeroBuilder
-
cache
Description copied from interface:FluxzeroConfigurationDefault cache used for internal stateful optimizations (e.g. handler state, snapshots).- Specified by:
cachein interfaceFluxzeroConfiguration
-
relationshipsCache
Description copied from interface:FluxzeroConfigurationDedicated cache used to store and lookup relationships between entities.- Specified by:
relationshipsCachein interfaceFluxzeroConfiguration
-
replaceIdentityProvider
Description copied from interface:FluxzeroBuilderReplaces the identity provider used to generate message and entity identifiers.- Specified by:
replaceIdentityProviderin interfaceFluxzeroBuilder
-
addParameterResolver
public DefaultFluxzero.Builder addParameterResolver(@NonNull @NonNull ParameterResolver<? super DeserializingMessage> parameterResolver) Description copied from interface:FluxzeroBuilderRegisters aParameterResolverto support injection of method arguments in handlers.- Specified by:
addParameterResolverin interfaceFluxzeroBuilder
-
disableErrorReporting
Description copied from interface:FluxzeroBuilderDisables automatic error reporting (e.g., viaErrorGateway).- Specified by:
disableErrorReportingin interfaceFluxzeroBuilder
-
disableShutdownHook
Description copied from interface:FluxzeroBuilderPrevents registration of a shutdown hook.- Specified by:
disableShutdownHookin interfaceFluxzeroBuilder
-
disableMessageCorrelation
Description copied from interface:FluxzeroBuilderDisables automatic message correlation.- Specified by:
disableMessageCorrelationin interfaceFluxzeroBuilder
-
disablePayloadValidation
Description copied from interface:FluxzeroBuilderDisables payload validation.- Specified by:
disablePayloadValidationin interfaceFluxzeroBuilder
-
disableWebParameterValidation
Description copied from interface:FluxzeroBuilderDisables validation of injected web parameters (e.g.@PathParam,@QueryParam).- Specified by:
disableWebParameterValidationin interfaceFluxzeroBuilder
-
disableDataProtection
Description copied from interface:FluxzeroBuilderDisables security filtering based on@FilterContent.- Specified by:
disableDataProtectionin interfaceFluxzeroBuilder
-
disableAutomaticAggregateCaching
Description copied from interface:FluxzeroBuilderDisables automatic caching of aggregates.- Specified by:
disableAutomaticAggregateCachingin interfaceFluxzeroBuilder
-
disableScheduledCommandHandler
Description copied from interface:FluxzeroBuilderPrevents installation of the default scheduled command handler.- Specified by:
disableScheduledCommandHandlerin interfaceFluxzeroBuilder
-
disableTrackingMetrics
Description copied from interface:FluxzeroBuilderDisables tracking of processing metrics.- Specified by:
disableTrackingMetricsin interfaceFluxzeroBuilder
-
disableCacheEvictionMetrics
Description copied from interface:FluxzeroBuilderDisables metrics related to cache eviction.- Specified by:
disableCacheEvictionMetricsin interfaceFluxzeroBuilder
-
disableWebResponseCompression
Description copied from interface:FluxzeroBuilderDisables compression for web responses.- Specified by:
disableWebResponseCompressionin interfaceFluxzeroBuilder
-
disableAdhocDispatchInterceptor
Description copied from interface:FluxzeroBuilderDisables support for dynamically injected dispatch interceptors.- Specified by:
disableAdhocDispatchInterceptorin interfaceFluxzeroBuilder
-
makeApplicationInstance
Description copied from interface:FluxzeroBuilderMarks the built instance as the global (application-level)Fluxzero.- Specified by:
makeApplicationInstancein interfaceFluxzeroBuilder
-
disableKeepalive
Description copied from interface:FluxzeroBuilderDisables Fluxzero’s built-in keepalive mechanism.By default, a Fluxzero instance keeps the JVM running after it is built by maintaining a single non-daemon thread. Calling this method disables that behavior, allowing the application to terminate normally once the main thread finishes.
- Specified by:
disableKeepalivein interfaceFluxzeroBuilder
-
enableHostMetrics
Description copied from interface:FluxzeroBuilderEnables host metrics collection with a custom configuration.- Specified by:
enableHostMetricsin interfaceFluxzeroBuilder- Parameters:
configuration- the host metrics configuration- Returns:
- this builder instance
- See Also:
-
build
Description copied from interface:FluxzeroBuilderBuilds the Fluxzero instance using the provided low-levelClient.- Specified by:
buildin interfaceFluxzeroBuilder
-
doBuild
protected Fluxzero doBuild(Map<MessageType, ? extends Tracking> trackingSupplier, Function<String, ? extends GenericGateway> customGatewaySupplier, CommandGateway commandGateway, QueryGateway queryGateway, EventGateway eventGateway, ResultGateway resultGateway, ErrorGateway errorGateway, MetricsGateway metricsGateway, WebRequestGateway webRequestGateway, AggregateRepository aggregateRepository, SnapshotStore snapshotStore, EventStore eventStore, KeyValueStore keyValueStore, DocumentStore documentStore, MessageScheduler messageScheduler, UserProvider userProvider, Cache cache, Serializer serializer, CorrelationDataProvider correlationDataProvider, IdentityProvider identityProvider, PropertySource propertySource, DelegatingClock clock, TaskScheduler taskScheduler, Client client, ThrowingRunnable shutdownHandler) -
getDefaultConsumerConfiguration
-
createRequestGateway
protected GenericGateway createRequestGateway(Client client, MessageType messageType, String topic, RequestHandler requestHandler, Map<MessageType, DispatchInterceptor> dispatchInterceptors, Map<MessageType, HandlerDecorator> handlerDecorators, List<ParameterResolver<? super DeserializingMessage>> parameterResolvers, Function<Class<?>, HandlerRepository> handlerRepositorySupplier, RepositoryProvider repositoryProvider, ResponseMapper responseMapper) -
localHandlerRegistry
protected HandlerRegistry localHandlerRegistry(MessageType messageType, Map<MessageType, HandlerDecorator> handlerDecorators, List<ParameterResolver<? super DeserializingMessage>> parameterResolvers, Map<MessageType, DispatchInterceptor> dispatchInterceptors, Function<Class<?>, HandlerRepository> handlerRepositorySupplier, RepositoryProvider repositoryProvider) -
methodInvocationValidator
protected MethodInvocationValidator<? super DeserializingMessage> methodInvocationValidator(MessageType messageType)
-