Interface FluxzeroBuilder

All Superinterfaces:
FluxzeroConfiguration
All Known Implementing Classes:
DefaultFluxzero.Builder

public interface FluxzeroBuilder extends FluxzeroConfiguration
Builder interface for constructing a Fluxzero instance.

This interface exposes advanced configuration hooks for customizing message handling, dispatch behavior, serialization, user resolution, correlation tracking, and many other aspects of a Fluxzero client. It is primarily used via DefaultFluxzero but can be extended or wrapped for deeper integrations.

  • Method Details

    • configureDefaultConsumer

      FluxzeroBuilder configureDefaultConsumer(io.fluxzero.common.MessageType messageType, UnaryOperator<ConsumerConfiguration> updateFunction)
      Update the default consumer configuration for the specified message type.
    • addConsumerConfiguration

      FluxzeroBuilder addConsumerConfiguration(ConsumerConfiguration consumerConfiguration, io.fluxzero.common.MessageType... messageTypes)
      Adds a specific consumer configuration for one or more message types.
    • addBatchInterceptor

      FluxzeroBuilder addBatchInterceptor(BatchInterceptor interceptor, io.fluxzero.common.MessageType... forTypes)
      Registers a BatchInterceptor that applies to the given message types.
    • addDispatchInterceptor

      default FluxzeroBuilder addDispatchInterceptor(DispatchInterceptor interceptor, io.fluxzero.common.MessageType... forTypes)
      Adds a DispatchInterceptor that modifies or monitors message dispatch. Shortcut for highPriority = false.
    • addDispatchInterceptor

      FluxzeroBuilder addDispatchInterceptor(DispatchInterceptor interceptor, boolean highPriority, io.fluxzero.common.MessageType... forTypes)
      Adds a DispatchInterceptor for specified message types with optional priority.
    • addHandlerInterceptor

      default FluxzeroBuilder addHandlerInterceptor(HandlerInterceptor interceptor, io.fluxzero.common.MessageType... forTypes)
      Adds a HandlerInterceptor for given message types.
    • addHandlerInterceptor

      default FluxzeroBuilder addHandlerInterceptor(HandlerInterceptor interceptor, boolean highPriority, io.fluxzero.common.MessageType... forTypes)
      Adds a HandlerInterceptor with specified priority.
    • addHandlerDecorator

      default FluxzeroBuilder addHandlerDecorator(HandlerDecorator decorator, io.fluxzero.common.MessageType... forTypes)
      Adds a HandlerDecorator for the given message types.
    • addHandlerDecorator

      FluxzeroBuilder addHandlerDecorator(HandlerDecorator decorator, boolean highPriority, io.fluxzero.common.MessageType... forTypes)
      Adds a HandlerDecorator with control over priority.
    • replaceMessageRoutingInterceptor

      FluxzeroBuilder replaceMessageRoutingInterceptor(DispatchInterceptor messageRoutingInterceptor)
      Replaces the default routing interceptor used for message dispatch.
    • replaceCache

      FluxzeroBuilder replaceCache(Cache cache)
      Replaces the default cache implementation.
    • forwardWebRequestsToLocalServer

      default FluxzeroBuilder forwardWebRequestsToLocalServer(int port)
      Forwards incoming MessageType.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 Fluxzero’s message-based @HandleWeb infrastructure.

      Note: This feature pushes requests to the local server and bypasses Fluxzero'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

      FluxzeroBuilder forwardWebRequestsToLocalServer(LocalServerConfig localServerConfig, UnaryOperator<ConsumerConfiguration> consumerConfigurator)
      Configures forwarding of MessageType.WEBREQUEST messages to a local HTTP server using the specified LocalServerConfig and custom consumer configuration.

      This mechanism is useful for advanced integration scenarios but bypasses Fluxzero'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 underlying ConsumerConfiguration
      Returns:
      this builder instance
      See Also:
    • replaceDefaultResponseMapper

      FluxzeroBuilder replaceDefaultResponseMapper(ResponseMapper responseMapper)
      Replaces the default response mapper used for generic result mapping.
    • replaceWebResponseMapper

      FluxzeroBuilder replaceWebResponseMapper(WebResponseMapper webResponseMapper)
      Replaces the WebResponseMapper used for handling web responses.
    • replaceTaskScheduler

      FluxzeroBuilder replaceTaskScheduler(Function<Clock,io.fluxzero.common.TaskScheduler> function)
      Replaces the default TaskScheduler implementation.
    • withAggregateCache

      FluxzeroBuilder withAggregateCache(Class<?> aggregateType, Cache cache)
      Configures a dedicated cache for a specific aggregate type.
    • replaceRelationshipsCache

      FluxzeroBuilder replaceRelationshipsCache(UnaryOperator<Cache> replaceFunction)
      Replaces the internal relationships cache with a new implementation.
    • replaceIdentityProvider

      FluxzeroBuilder replaceIdentityProvider(UnaryOperator<IdentityProvider> replaceFunction)
      Replaces the identity provider used to generate message and entity identifiers.
    • addParameterResolver

      FluxzeroBuilder addParameterResolver(io.fluxzero.common.handling.ParameterResolver<? super DeserializingMessage> parameterResolver)
      Registers a ParameterResolver to support injection of method arguments in handlers.
    • replaceSerializer

      FluxzeroBuilder replaceSerializer(Serializer serializer)
      Replaces the default serializer used for events, commands, snapshots, and documents.
    • replaceCorrelationDataProvider

      FluxzeroBuilder replaceCorrelationDataProvider(UnaryOperator<CorrelationDataProvider> correlationDataProvider)
      Replaces the CorrelationDataProvider used to attach correlation data to messages.
    • replaceSnapshotSerializer

      FluxzeroBuilder replaceSnapshotSerializer(Serializer serializer)
      Overrides the serializer used specifically for snapshot serialization.
    • replaceDocumentSerializer

      FluxzeroBuilder replaceDocumentSerializer(DocumentSerializer documentSerializer)
      Replaces the document serializer for search indexing.
    • registerUserProvider

      FluxzeroBuilder registerUserProvider(UserProvider userProvider)
      Registers a user provider used for resolving and authenticating User instances.
    • addPropertySource

      default FluxzeroBuilder addPropertySource(io.fluxzero.common.application.PropertySource propertySource)
      Adds a PropertySource to the configuration chain.
    • replacePropertySource

      FluxzeroBuilder replacePropertySource(UnaryOperator<io.fluxzero.common.application.PropertySource> replacer)
      Replaces the existing property source.
    • disableErrorReporting

      FluxzeroBuilder disableErrorReporting()
      Disables automatic error reporting (e.g., via ErrorGateway).
    • disableShutdownHook

      FluxzeroBuilder disableShutdownHook()
      Prevents registration of a shutdown hook.
    • disableMessageCorrelation

      FluxzeroBuilder disableMessageCorrelation()
      Disables automatic message correlation.
    • disablePayloadValidation

      FluxzeroBuilder disablePayloadValidation()
      Disables payload validation.
    • disableDataProtection

      FluxzeroBuilder disableDataProtection()
      Disables security filtering based on @FilterContent.
    • disableAutomaticAggregateCaching

      FluxzeroBuilder disableAutomaticAggregateCaching()
      Disables automatic caching of aggregates.
    • disableScheduledCommandHandler

      FluxzeroBuilder disableScheduledCommandHandler()
      Prevents installation of the default scheduled command handler.
    • disableTrackingMetrics

      FluxzeroBuilder disableTrackingMetrics()
      Disables tracking of processing metrics.
    • disableCacheEvictionMetrics

      FluxzeroBuilder disableCacheEvictionMetrics()
      Disables metrics related to cache eviction.
    • disableWebResponseCompression

      FluxzeroBuilder disableWebResponseCompression()
      Disables compression for web responses.
    • disableAdhocDispatchInterceptor

      FluxzeroBuilder disableAdhocDispatchInterceptor()
      Disables support for dynamically injected dispatch interceptors.
    • makeApplicationInstance

      FluxzeroBuilder makeApplicationInstance(boolean makeApplicationInstance)
      Marks the built instance as the global (application-level) Fluxzero.
    • build

      Fluxzero build(Client client)
      Builds the Fluxzero instance using the provided low-level Client.