Class DefaultFluxzero.Builder
java.lang.Object
io.fluxzero.sdk.configuration.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, boolean highPriority, MessageType... forTypes) Adds aDispatchInterceptorfor specified message types with optional priority.addHandlerDecorator(@NonNull HandlerDecorator interceptor, boolean highPriority, MessageType... forTypes) Adds aHandlerDecoratorwith control over priority.addParameterResolver(@NonNull ParameterResolver<? super DeserializingMessage> parameterResolver) Registers aParameterResolverto support injection of method arguments in handlers.Builds the Fluxzero instance using the provided low-levelClient.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 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) 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.registerUserProvider(UserProvider userProvider) Registers a user provider used for resolving and authenticatingUserinstances.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
addDispatchInterceptor, addHandlerDecorator, addHandlerInterceptor, addHandlerInterceptor, addPropertySource, disableAutomaticTracking, forwardWebRequestsToLocalServerMethods inherited from interface FluxzeroConfiguration
cache, clock, correlationDataProvider, customConsumerConfigurations, customParameterResolvers, defaultConsumerConfigurations, defaultResponseMapper, documentSerializer, forwardingWebConsumer, generalBatchInterceptors, highPrioDispatchInterceptors, highPrioHandlerDecorators, identityProvider, lowPrioDispatchInterceptors, lowPrioHandlerDecorators, makeApplicationInstance, messageRoutingInterceptor, propertySource, relationshipsCache, 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.- Specified by:
addBatchInterceptorin interfaceFluxzeroBuilder
-
addDispatchInterceptor
public DefaultFluxzero.Builder addDispatchInterceptor(@NonNull @NonNull DispatchInterceptor interceptor, boolean highPriority, MessageType... forTypes) Description copied from interface:FluxzeroBuilderAdds aDispatchInterceptorfor specified message types with optional priority.- Specified by:
addDispatchInterceptorin interfaceFluxzeroBuilder
-
addHandlerDecorator
public DefaultFluxzero.Builder addHandlerDecorator(@NonNull @NonNull HandlerDecorator interceptor, boolean highPriority, MessageType... forTypes) Description copied from interface:FluxzeroBuilderAdds aHandlerDecoratorwith control over priority.- 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
-
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
-
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
-
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)
-