Interface HandlerRepository
- All Known Implementing Classes:
BatchingHandlerRepository
,DefaultHandlerRepository
public interface HandlerRepository
Repository interface for storing and retrieving
@Stateful
handler instances.
Handlers are typically indexed and matched based on their @Association
fields and methods.
Implementations of this interface provide the backing logic to locate, store, and remove these handlers.
This interface is particularly useful in scenarios involving sagas, process managers, or other stateful event-driven components where runtime state needs to be persisted and recalled based on message correlation data.
-
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.Collection
<? extends Entry<?>> getAll()
Retrieves all currently stored handler instances.Persists or updates the handler instance identified by the given ID.
-
Method Details
-
findByAssociation
Finds 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
@Association
in registered handler instances.- 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
Collection<? extends Entry<?>> getAll()Retrieves all currently stored handler instances.- Returns:
- a collection of all known handler entries
-
put
Persists or updates the handler instance identified by the given ID.- 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
Removes the handler instance identified by the given ID from the repository.- Parameters:
id
- the identifier of the handler instance to delete- Returns:
- a future that completes when the deletion has finished
-