Class DefaultFluxCapacitor.Builder
java.lang.Object
io.fluxcapacitor.javaclient.configuration.DefaultFluxCapacitor.Builder
- All Implemented Interfaces:
FluxCapacitorBuilder
,FluxCapacitorConfiguration
- Enclosing class:
DefaultFluxCapacitor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddBatchInterceptor
(BatchInterceptor interceptor, MessageType... forTypes) Registers aBatchInterceptor
that 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 aDispatchInterceptor
for specified message types with optional priority.addHandlerDecorator
(@NonNull HandlerDecorator interceptor, boolean highPriority, MessageType... forTypes) Adds aHandlerDecorator
with control over priority.addParameterResolver
(@NonNull ParameterResolver<? super DeserializingMessage> parameterResolver) Registers aParameterResolver
to support injection of method arguments in handlers.Builds the FluxCapacitor 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 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) 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 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 FluxCapacitor
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) forwardWebRequestsToLocalServer
(LocalServerConfig localServerConfig, UnaryOperator<ConsumerConfiguration> consumerConfigurator) Configures forwarding ofMessageType.WEBREQUEST
messages to a local HTTP server using the specifiedLocalServerConfig
and custom consumer configuration.protected ConsumerConfiguration
getDefaultConsumerConfiguration
(MessageType messageType) protected HandlerRegistry
localHandlerRegistry
(MessageType messageType, Map<MessageType, HandlerDecorator> handlerDecorators, List<ParameterResolver<? super DeserializingMessage>> parameterResolvers, Function<Class<?>, HandlerRepository> handlerRepositorySupplier, RepositoryProvider repositoryProvider) makeApplicationInstance
(boolean makeApplicationInstance) Marks the built instance as the global (application-level)FluxCapacitor
.registerUserProvider
(UserProvider userProvider) Registers a user provider used for resolving and authenticatingUser
instances.replaceCache
(@NonNull Cache cache) Replaces the default cache implementation.replaceCorrelationDataProvider
(@NonNull UnaryOperator<CorrelationDataProvider> replaceFunction) Replaces theCorrelationDataProvider
used 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 defaultTaskScheduler
implementation.replaceWebResponseMapper
(WebResponseMapper webResponseMapper) Replaces theWebResponseMapper
used for handling web responses.withAggregateCache
(Class<?> aggregateType, Cache cache) Configures a dedicated cache for a specific aggregate type.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.fluxcapacitor.javaclient.configuration.FluxCapacitorBuilder
addDispatchInterceptor, addHandlerDecorator, addHandlerInterceptor, addHandlerInterceptor, addPropertySource, forwardWebRequestsToLocalServer
Methods inherited from interface io.fluxcapacitor.javaclient.configuration.FluxCapacitorConfiguration
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:FluxCapacitorBuilder
Replaces the default serializer used for events, commands, snapshots, and documents.- Specified by:
replaceSerializer
in interfaceFluxCapacitorBuilder
-
replaceCorrelationDataProvider
public FluxCapacitorBuilder replaceCorrelationDataProvider(@NonNull @NonNull UnaryOperator<CorrelationDataProvider> replaceFunction) Description copied from interface:FluxCapacitorBuilder
Replaces theCorrelationDataProvider
used to attach correlation data to messages.- Specified by:
replaceCorrelationDataProvider
in interfaceFluxCapacitorBuilder
-
replaceSnapshotSerializer
public DefaultFluxCapacitor.Builder replaceSnapshotSerializer(@NonNull @NonNull Serializer serializer) Description copied from interface:FluxCapacitorBuilder
Overrides the serializer used specifically for snapshot serialization.- Specified by:
replaceSnapshotSerializer
in interfaceFluxCapacitorBuilder
-
replaceDocumentSerializer
public FluxCapacitorBuilder replaceDocumentSerializer(@NonNull @NonNull DocumentSerializer documentSerializer) Description copied from interface:FluxCapacitorBuilder
Replaces the document serializer for search indexing.- Specified by:
replaceDocumentSerializer
in interfaceFluxCapacitorBuilder
-
registerUserProvider
Description copied from interface:FluxCapacitorBuilder
Registers a user provider used for resolving and authenticatingUser
instances.- Specified by:
registerUserProvider
in interfaceFluxCapacitorBuilder
-
replacePropertySource
Description copied from interface:FluxCapacitorBuilder
Replaces the existing property source.- Specified by:
replacePropertySource
in interfaceFluxCapacitorBuilder
-
configureDefaultConsumer
public DefaultFluxCapacitor.Builder configureDefaultConsumer(@NonNull @NonNull MessageType messageType, @NonNull @NonNull UnaryOperator<ConsumerConfiguration> updateFunction) Description copied from interface:FluxCapacitorBuilder
Update the default consumer configuration for the specified message type.- Specified by:
configureDefaultConsumer
in interfaceFluxCapacitorBuilder
-
addConsumerConfiguration
public DefaultFluxCapacitor.Builder addConsumerConfiguration(@NonNull @NonNull ConsumerConfiguration configuration, MessageType... messageTypes) Description copied from interface:FluxCapacitorBuilder
Adds a specific consumer configuration for one or more message types.- Specified by:
addConsumerConfiguration
in interfaceFluxCapacitorBuilder
-
addBatchInterceptor
public FluxCapacitorBuilder addBatchInterceptor(BatchInterceptor interceptor, MessageType... forTypes) Description copied from interface:FluxCapacitorBuilder
Registers aBatchInterceptor
that applies to the given message types.- Specified by:
addBatchInterceptor
in interfaceFluxCapacitorBuilder
-
addDispatchInterceptor
public DefaultFluxCapacitor.Builder addDispatchInterceptor(@NonNull @NonNull DispatchInterceptor interceptor, boolean highPriority, MessageType... forTypes) Description copied from interface:FluxCapacitorBuilder
Adds aDispatchInterceptor
for specified message types with optional priority.- Specified by:
addDispatchInterceptor
in interfaceFluxCapacitorBuilder
-
addHandlerDecorator
public DefaultFluxCapacitor.Builder addHandlerDecorator(@NonNull @NonNull HandlerDecorator interceptor, boolean highPriority, MessageType... forTypes) Description copied from interface:FluxCapacitorBuilder
Adds aHandlerDecorator
with control over priority.- Specified by:
addHandlerDecorator
in interfaceFluxCapacitorBuilder
-
replaceMessageRoutingInterceptor
public DefaultFluxCapacitor.Builder replaceMessageRoutingInterceptor(@NonNull @NonNull DispatchInterceptor messageRoutingInterceptor) Description copied from interface:FluxCapacitorBuilder
Replaces the default routing interceptor used for message dispatch.- Specified by:
replaceMessageRoutingInterceptor
in interfaceFluxCapacitorBuilder
-
replaceCache
Description copied from interface:FluxCapacitorBuilder
Replaces the default cache implementation.- Specified by:
replaceCache
in interfaceFluxCapacitorBuilder
-
forwardWebRequestsToLocalServer
public FluxCapacitorBuilder forwardWebRequestsToLocalServer(LocalServerConfig localServerConfig, UnaryOperator<ConsumerConfiguration> consumerConfigurator) Description copied from interface:FluxCapacitorBuilder
Configures forwarding ofMessageType.WEBREQUEST
messages to a local HTTP server using the specifiedLocalServerConfig
and custom consumer configuration.This mechanism is useful for advanced integration scenarios but bypasses Flux's pull-based message tracking. Prefer native
@HandleWeb
handlers when possible.- Specified by:
forwardWebRequestsToLocalServer
in interfaceFluxCapacitorBuilder
- 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:FluxCapacitorBuilder
Replaces the default response mapper used for generic result mapping.- Specified by:
replaceDefaultResponseMapper
in interfaceFluxCapacitorBuilder
-
replaceWebResponseMapper
Description copied from interface:FluxCapacitorBuilder
Replaces theWebResponseMapper
used for handling web responses.- Specified by:
replaceWebResponseMapper
in interfaceFluxCapacitorBuilder
-
replaceTaskScheduler
Description copied from interface:FluxCapacitorBuilder
Replaces the defaultTaskScheduler
implementation.- Specified by:
replaceTaskScheduler
in interfaceFluxCapacitorBuilder
-
withAggregateCache
Description copied from interface:FluxCapacitorBuilder
Configures a dedicated cache for a specific aggregate type.- Specified by:
withAggregateCache
in interfaceFluxCapacitorBuilder
-
replaceRelationshipsCache
Description copied from interface:FluxCapacitorBuilder
Replaces the internal relationships cache with a new implementation.- Specified by:
replaceRelationshipsCache
in interfaceFluxCapacitorBuilder
-
replaceIdentityProvider
public FluxCapacitorBuilder replaceIdentityProvider(UnaryOperator<IdentityProvider> replaceFunction) Description copied from interface:FluxCapacitorBuilder
Replaces the identity provider used to generate message and entity identifiers.- Specified by:
replaceIdentityProvider
in interfaceFluxCapacitorBuilder
-
addParameterResolver
public DefaultFluxCapacitor.Builder addParameterResolver(@NonNull @NonNull ParameterResolver<? super DeserializingMessage> parameterResolver) Description copied from interface:FluxCapacitorBuilder
Registers aParameterResolver
to support injection of method arguments in handlers.- Specified by:
addParameterResolver
in interfaceFluxCapacitorBuilder
-
disableErrorReporting
Description copied from interface:FluxCapacitorBuilder
Disables automatic error reporting (e.g., viaErrorGateway
).- Specified by:
disableErrorReporting
in interfaceFluxCapacitorBuilder
-
disableShutdownHook
Description copied from interface:FluxCapacitorBuilder
Prevents registration of a shutdown hook.- Specified by:
disableShutdownHook
in interfaceFluxCapacitorBuilder
-
disableMessageCorrelation
Description copied from interface:FluxCapacitorBuilder
Disables automatic message correlation.- Specified by:
disableMessageCorrelation
in interfaceFluxCapacitorBuilder
-
disablePayloadValidation
Description copied from interface:FluxCapacitorBuilder
Disables payload validation.- Specified by:
disablePayloadValidation
in interfaceFluxCapacitorBuilder
-
disableDataProtection
Description copied from interface:FluxCapacitorBuilder
Disables security filtering based on@FilterContent
.- Specified by:
disableDataProtection
in interfaceFluxCapacitorBuilder
-
disableAutomaticAggregateCaching
Description copied from interface:FluxCapacitorBuilder
Disables automatic caching of aggregates.- Specified by:
disableAutomaticAggregateCaching
in interfaceFluxCapacitorBuilder
-
disableScheduledCommandHandler
Description copied from interface:FluxCapacitorBuilder
Prevents installation of the default scheduled command handler.- Specified by:
disableScheduledCommandHandler
in interfaceFluxCapacitorBuilder
-
disableTrackingMetrics
Description copied from interface:FluxCapacitorBuilder
Disables tracking of processing metrics.- Specified by:
disableTrackingMetrics
in interfaceFluxCapacitorBuilder
-
disableCacheEvictionMetrics
Description copied from interface:FluxCapacitorBuilder
Disables metrics related to cache eviction.- Specified by:
disableCacheEvictionMetrics
in interfaceFluxCapacitorBuilder
-
disableWebResponseCompression
Description copied from interface:FluxCapacitorBuilder
Disables compression for web responses.- Specified by:
disableWebResponseCompression
in interfaceFluxCapacitorBuilder
-
disableAdhocDispatchInterceptor
Description copied from interface:FluxCapacitorBuilder
Disables support for dynamically injected dispatch interceptors.- Specified by:
disableAdhocDispatchInterceptor
in interfaceFluxCapacitorBuilder
-
makeApplicationInstance
Description copied from interface:FluxCapacitorBuilder
Marks the built instance as the global (application-level)FluxCapacitor
.- Specified by:
makeApplicationInstance
in interfaceFluxCapacitorBuilder
-
build
Description copied from interface:FluxCapacitorBuilder
Builds the FluxCapacitor instance using the provided low-levelClient
.- Specified by:
build
in interfaceFluxCapacitorBuilder
-
doBuild
protected FluxCapacitor 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, Function<Class<?>, HandlerRepository> handlerRepositorySupplier, RepositoryProvider repositoryProvider)
-