Interface HandlerRepository
- All Superinterfaces:
Namespaced<HandlerRepository>
- All Known Implementing Classes:
BatchingHandlerRepository, DefaultHandlerRepository
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.default HandlerRepositoryforNamespace(String namespace) Returns the resource scoped to the specified namespace.Collection<? extends Entry<?>> getAll()Retrieves all currently stored handler instances.Persists or updates the handler instance identified by the given ID.Methods inherited from interface Namespaced
forApplicationNamespace, forDefaultNamespace
-
Method Details
-
forNamespace
Description copied from interface:NamespacedReturns the resource scoped to the specified namespace. Passingnullselects the namespace configured for this application.- Specified by:
forNamespacein interfaceNamespaced<HandlerRepository>- Parameters:
namespace- the namespace to which the returned resource is scoped, ornullfor the application namespace- Returns:
- the resource associated with the specified namespace
-
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
@Associationin 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
-