Class Reducers
Represents an implementation of IReducers.
public class Reducers : IReducers
- Inheritance
-
Reducers
- Implements
- Inherited Members
- Extension Methods
Constructors
Reducers(IEventStore, IClientArtifactsProvider, IServiceProvider, IClientArtifactsActivator, IReducerValidator, IEventTypes, INamingPolicy, JsonSerializerOptions, IIdentityProvider, IReducerObservers, ILogger<Reducers>)
Initializes a new instance of the Reducers class.
public Reducers(IEventStore eventStore, IClientArtifactsProvider clientArtifacts, IServiceProvider serviceProvider, IClientArtifactsActivator artifactActivator, IReducerValidator reducerValidator, IEventTypes eventTypes, INamingPolicy namingPolicy, JsonSerializerOptions jsonSerializerOptions, IIdentityProvider identityProvider, IReducerObservers reducerObservers, ILogger<Reducers> logger)
Parameters
eventStoreIEventStoreIEventStore the reducers belong to.
clientArtifactsIClientArtifactsProviderIClientArtifactsProvider for discovery.
serviceProviderIServiceProviderIServiceProvider to get instances of types.
artifactActivatorIClientArtifactsActivatorIClientArtifactsActivator for creating artifact instances.
reducerValidatorIReducerValidatorIReducerValidator for validating reducer types.
eventTypesIEventTypesRegistered IEventTypes.
namingPolicyINamingPolicyINamingPolicy for converting names during serialization.
jsonSerializerOptionsJsonSerializerOptionsJsonSerializerOptions for JSON serialization.
identityProviderIIdentityProviderIIdentityProvider for managing identity context.
reducerObserversIReducerObserversIReducerObservers for managing reducer observers.
loggerILogger<Reducers>ILogger for logging.
Methods
Discover()
Discover all reducers from the entry assembly and dependencies.
public Task Discover()
Returns
- Task
Awaitable task.
GetAllHandlers()
Get all registered handlers.
public IEnumerable<IReducerHandler> GetAllHandlers()
Returns
- IEnumerable<IReducerHandler>
Collection of IReducerHandler.
GetClrType(ReducerId)
Get the CLR type for a specific reducer.
public Type GetClrType(ReducerId reducerId)
Parameters
Returns
- Type
The type.
GetFailedPartitionsFor(Type)
Get any failed partitions for a specific reducer.
public Task<IEnumerable<FailedPartition>> GetFailedPartitionsFor(Type reducerType)
Parameters
reducerTypeTypeType of reducer.
Returns
- Task<IEnumerable<FailedPartition>>
Collection of FailedPartition, if any.
GetFailedPartitionsFor<TReducer>()
Get any failed partitions for a specific reducer.
public Task<IEnumerable<FailedPartition>> GetFailedPartitionsFor<TReducer>() where TReducer : IReducer
Returns
- Task<IEnumerable<FailedPartition>>
Collection of FailedPartition, if any.
Type Parameters
TReducerType of reducer.
GetHandlerById(ReducerId)
Get all registered reducers by its identifier.
public IReducerHandler GetHandlerById(ReducerId reducerId)
Parameters
reducerIdReducerIdThe identifier of the reducer to get.
Returns
- IReducerHandler
IReducerHandler instance.
GetHandlerFor(Type)
Gets a specific handler by its reducer type.
public IReducerHandler GetHandlerFor(Type reducerType)
Parameters
reducerTypeTypeThe reducer type to get for.
Returns
GetHandlerForReadModelType(Type)
Get a specific handler for a specific model type.
public IReducerHandler GetHandlerForReadModelType(Type readModelType)
Parameters
readModelTypeTypeModel type to get for.
Returns
- IReducerHandler
IReducerHandler instance.
GetHandlerFor<TReducer>()
Get a specific handler for a specific reducer.
public IReducerHandler GetHandlerFor<TReducer>() where TReducer : IReducer
Returns
Type Parameters
TReducerType of reducer to get for.
GetStateFor<TReducer>()
Get the state of a specific reactor.
public Task<ReducerState> GetStateFor<TReducer>() where TReducer : IReducer
Returns
Type Parameters
TReducerType of reactor get for.
HasFor(Type)
Check if there is a reducer for a specific read model type.
public bool HasFor(Type readModelType)
Parameters
readModelTypeTypeThe read model type to check for.
Returns
- bool
True if it has, false if not.
HasFor<TReadModel>()
Check if there is a reducer for a specific read model type.
public bool HasFor<TReadModel>()
Returns
- bool
True if it has, false if not.
Type Parameters
TReadModelThe read model type to check for.
HasReducerFor(Type)
Check if there is a reducer for a specific model type.
public bool HasReducerFor(Type readModelType)
Parameters
readModelTypeTypeModel type to check for.
Returns
- bool
True if it has, false if not.
Register()
Register all reducers with Chronicle.
public Task Register()
Returns
- Task
Awaitable task.
Register<TReducer, TReadModel>()
Registers a TReducer reducer with Chronicle.
public Task<IReducerHandler> Register<TReducer, TReadModel>() where TReducer : IReducerFor<TReadModel> where TReadModel : class
Returns
- Task<IReducerHandler>
Awaitable task.
Type Parameters
TReducerThe reactor type.
TReadModelThe model type the reducer is for.
Replay(ReducerId)
Replay a specific reducer by its identifier.
public Task Replay(ReducerId reducerId)
Parameters
Returns
- Task
Awaitable task.
Replay<TReducer>()
Replay a specific reducer.
public Task Replay<TReducer>() where TReducer : IReducer
Returns
- Task
Awaitable task.
Type Parameters
TReducerType of reducer to replay.