Interface FluxCapacitorBuilder
- All Superinterfaces:
FluxCapacitorConfiguration
- All Known Implementing Classes:
DefaultFluxCapacitor.Builder
FluxCapacitor
instance.
This interface exposes advanced configuration hooks for customizing message handling, dispatch behavior,
serialization, user resolution, correlation tracking, and many other aspects of a Flux Capacitor client. It is
primarily used via DefaultFluxCapacitor
but can be extended or
wrapped for deeper integrations.
-
Method Summary
Modifier and TypeMethodDescriptionaddBatchInterceptor
(BatchInterceptor interceptor, MessageType... forTypes) Registers aBatchInterceptor
that applies to the given message types.addConsumerConfiguration
(ConsumerConfiguration consumerConfiguration, MessageType... messageTypes) Adds a specific consumer configuration for one or more message types.addDispatchInterceptor
(DispatchInterceptor interceptor, boolean highPriority, MessageType... forTypes) Adds aDispatchInterceptor
for specified message types with optional priority.default FluxCapacitorBuilder
addDispatchInterceptor
(DispatchInterceptor interceptor, MessageType... forTypes) Adds aDispatchInterceptor
that modifies or monitors message dispatch.addHandlerDecorator
(HandlerDecorator decorator, boolean highPriority, MessageType... forTypes) Adds aHandlerDecorator
with control over priority.default FluxCapacitorBuilder
addHandlerDecorator
(HandlerDecorator decorator, MessageType... forTypes) Adds aHandlerDecorator
for the given message types.default FluxCapacitorBuilder
addHandlerInterceptor
(HandlerInterceptor interceptor, boolean highPriority, MessageType... forTypes) Adds aHandlerInterceptor
with specified priority.default FluxCapacitorBuilder
addHandlerInterceptor
(HandlerInterceptor interceptor, MessageType... forTypes) Adds aHandlerInterceptor
for given message types.addParameterResolver
(ParameterResolver<? super DeserializingMessage> parameterResolver) Registers aParameterResolver
to support injection of method arguments in handlers.default FluxCapacitorBuilder
addPropertySource
(PropertySource propertySource) Adds aPropertySource
to the configuration chain.Builds the FluxCapacitor instance using the provided low-levelClient
.configureDefaultConsumer
(MessageType messageType, UnaryOperator<ConsumerConfiguration> updateFunction) Update the default consumer configuration for the specified message type.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.default FluxCapacitorBuilder
forwardWebRequestsToLocalServer
(int port) Forwards incomingMessageType.WEBREQUEST
messages to a locally running HTTP server on the specified port.forwardWebRequestsToLocalServer
(LocalServerConfig localServerConfig, UnaryOperator<ConsumerConfiguration> consumerConfigurator) Configures forwarding ofMessageType.WEBREQUEST
messages to a local HTTP server using the specifiedLocalServerConfig
and custom consumer configuration.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
(Cache cache) Replaces the default cache implementation.replaceCorrelationDataProvider
(UnaryOperator<CorrelationDataProvider> correlationDataProvider) Replaces theCorrelationDataProvider
used to attach correlation data to messages.replaceDefaultResponseMapper
(ResponseMapper responseMapper) Replaces the default response mapper used for generic result mapping.replaceDocumentSerializer
(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
(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
(Serializer serializer) Replaces the default serializer used for events, commands, snapshots, and documents.replaceSnapshotSerializer
(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 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
-
Method Details
-
configureDefaultConsumer
FluxCapacitorBuilder configureDefaultConsumer(MessageType messageType, UnaryOperator<ConsumerConfiguration> updateFunction) Update the default consumer configuration for the specified message type. -
addConsumerConfiguration
FluxCapacitorBuilder addConsumerConfiguration(ConsumerConfiguration consumerConfiguration, MessageType... messageTypes) Adds a specific consumer configuration for one or more message types. -
addBatchInterceptor
Registers aBatchInterceptor
that applies to the given message types. -
addDispatchInterceptor
default FluxCapacitorBuilder addDispatchInterceptor(DispatchInterceptor interceptor, MessageType... forTypes) Adds aDispatchInterceptor
that modifies or monitors message dispatch. Shortcut for highPriority = false. -
addDispatchInterceptor
FluxCapacitorBuilder addDispatchInterceptor(DispatchInterceptor interceptor, boolean highPriority, MessageType... forTypes) Adds aDispatchInterceptor
for specified message types with optional priority. -
addHandlerInterceptor
default FluxCapacitorBuilder addHandlerInterceptor(HandlerInterceptor interceptor, MessageType... forTypes) Adds aHandlerInterceptor
for given message types. -
addHandlerInterceptor
default FluxCapacitorBuilder addHandlerInterceptor(HandlerInterceptor interceptor, boolean highPriority, MessageType... forTypes) Adds aHandlerInterceptor
with specified priority. -
addHandlerDecorator
default FluxCapacitorBuilder addHandlerDecorator(HandlerDecorator decorator, MessageType... forTypes) Adds aHandlerDecorator
for the given message types. -
addHandlerDecorator
FluxCapacitorBuilder addHandlerDecorator(HandlerDecorator decorator, boolean highPriority, MessageType... forTypes) Adds aHandlerDecorator
with control over priority. -
replaceMessageRoutingInterceptor
FluxCapacitorBuilder replaceMessageRoutingInterceptor(DispatchInterceptor messageRoutingInterceptor) Replaces the default routing interceptor used for message dispatch. -
replaceCache
Replaces the default cache implementation. -
forwardWebRequestsToLocalServer
Forwards incomingMessageType.WEBREQUEST
messages to a locally running HTTP server on the specified port.This allows applications to handle web requests using their own HTTP server rather than Flux Capacitor’s message-based
@HandleWeb
infrastructure.Note: This feature pushes requests to the local server and bypasses Flux’s pull-based dispatch model. Its use is discouraged unless integration with an existing HTTP stack is required.
- Parameters:
port
- the port on which the local HTTP server is listening- Returns:
- this builder instance
- See Also:
-
forwardWebRequestsToLocalServer
FluxCapacitorBuilder forwardWebRequestsToLocalServer(LocalServerConfig localServerConfig, UnaryOperator<ConsumerConfiguration> consumerConfigurator) 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.- 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
Replaces the default response mapper used for generic result mapping. -
replaceWebResponseMapper
Replaces theWebResponseMapper
used for handling web responses. -
replaceTaskScheduler
Replaces the defaultTaskScheduler
implementation. -
withAggregateCache
Configures a dedicated cache for a specific aggregate type. -
replaceRelationshipsCache
Replaces the internal relationships cache with a new implementation. -
replaceIdentityProvider
Replaces the identity provider used to generate message and entity identifiers. -
addParameterResolver
FluxCapacitorBuilder addParameterResolver(ParameterResolver<? super DeserializingMessage> parameterResolver) Registers aParameterResolver
to support injection of method arguments in handlers. -
replaceSerializer
Replaces the default serializer used for events, commands, snapshots, and documents. -
replaceCorrelationDataProvider
FluxCapacitorBuilder replaceCorrelationDataProvider(UnaryOperator<CorrelationDataProvider> correlationDataProvider) Replaces theCorrelationDataProvider
used to attach correlation data to messages. -
replaceSnapshotSerializer
Overrides the serializer used specifically for snapshot serialization. -
replaceDocumentSerializer
Replaces the document serializer for search indexing. -
registerUserProvider
Registers a user provider used for resolving and authenticatingUser
instances. -
addPropertySource
Adds aPropertySource
to the configuration chain. -
replacePropertySource
Replaces the existing property source. -
disableErrorReporting
FluxCapacitorBuilder disableErrorReporting()Disables automatic error reporting (e.g., viaErrorGateway
). -
disableShutdownHook
FluxCapacitorBuilder disableShutdownHook()Prevents registration of a shutdown hook. -
disableMessageCorrelation
FluxCapacitorBuilder disableMessageCorrelation()Disables automatic message correlation. -
disablePayloadValidation
FluxCapacitorBuilder disablePayloadValidation()Disables payload validation. -
disableDataProtection
FluxCapacitorBuilder disableDataProtection()Disables security filtering based on@FilterContent
. -
disableAutomaticAggregateCaching
FluxCapacitorBuilder disableAutomaticAggregateCaching()Disables automatic caching of aggregates. -
disableScheduledCommandHandler
FluxCapacitorBuilder disableScheduledCommandHandler()Prevents installation of the default scheduled command handler. -
disableTrackingMetrics
FluxCapacitorBuilder disableTrackingMetrics()Disables tracking of processing metrics. -
disableCacheEvictionMetrics
FluxCapacitorBuilder disableCacheEvictionMetrics()Disables metrics related to cache eviction. -
disableWebResponseCompression
FluxCapacitorBuilder disableWebResponseCompression()Disables compression for web responses. -
disableAdhocDispatchInterceptor
FluxCapacitorBuilder disableAdhocDispatchInterceptor()Disables support for dynamically injected dispatch interceptors. -
makeApplicationInstance
Marks the built instance as the global (application-level)FluxCapacitor
. -
build
Builds the FluxCapacitor instance using the provided low-levelClient
.
-