Class BatchingHandlerRepository
java.lang.Object
io.fluxzero.sdk.modeling.BatchingHandlerRepository
- All Implemented Interfaces:
HandlerRepository
A batching wrapper for
HandlerRepository that delays persistence operations until the end of the current
message batch.
This implementation is intended for use with @Stateful(commitInBatch = true)
handlers. It buffers all put() and delete() calls and flushes them via
DocumentStore.bulkUpdate(Collection) once batch processing completes.
Association lookups during batch processing always take into account:
- The persisted state (from the backing repository), and
- The in-memory cache of batch-local updates (created, updated, or deleted handlers) that have not been committed.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classRepresents a buffered update to a handler instance (either index or delete). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRemoves the handler instance identified by the given ID from the repository.Collection<? extends Entry<?>> findByAssociation(Map<Object, String> associations) Finds all handler instances that match the given set of associations.protected voidCollection<? extends Entry<?>> getAll()Retrieves all currently stored handler instances.Persists or updates the handler instance identified by the given ID.removeOutdatedValues(Collection<? extends Entry<?>> delegateResult) protected Map<Object, BatchingHandlerRepository.Update> updates()
-
Constructor Details
-
BatchingHandlerRepository
public BatchingHandlerRepository()
-
-
Method Details
-
findByAssociation
Description copied from interface:HandlerRepositoryFinds all handler instances that match the given set of associations.The association map typically represents values extracted from incoming messages (e.g., correlation keys) and will be matched against fields or methods annotated with
@Associationin registered handler instances.- Specified by:
findByAssociationin interfaceHandlerRepository- Parameters:
associations- a map of association values, where the key is the value to match and the value is the corresponding property name or path (e.g.foo/bar/name) in the handler- Returns:
- a collection of entries representing matching handler instances
-
getAll
Description copied from interface:HandlerRepositoryRetrieves all currently stored handler instances.- Specified by:
getAllin interfaceHandlerRepository- Returns:
- a collection of all known handler entries
-
removeOutdatedValues
protected Stream<? extends Entry<?>> removeOutdatedValues(Collection<? extends Entry<?>> delegateResult) -
put
Description copied from interface:HandlerRepositoryPersists or updates the handler instance identified by the given ID.- Specified by:
putin interfaceHandlerRepository- Parameters:
id- the unique identifier for the handler instancevalue- the handler instance to persist- Returns:
- a future that completes when the operation has finished
-
delete
Description copied from interface:HandlerRepositoryRemoves the handler instance identified by the given ID from the repository.- Specified by:
deletein interfaceHandlerRepository- Parameters:
id- the identifier of the handler instance to delete- Returns:
- a future that completes when the deletion has finished
-
updates
-
flushUpdates
-