Table of Contents

Class ReducerHandler

Namespace
Cratis.Chronicle.Reducers
Assembly
Cratis.Chronicle.dll

Represents an implementation of IReducerHandler.

public class ReducerHandler : IReducerHandler, IDisposable
Inheritance
ReducerHandler
Implements
Inherited Members
Extension Methods

Remarks

Initializes a new instance of the ReducerHandler class.

Constructors

ReducerHandler(IEventStore, ReducerId, EventSequenceId, IReducerInvoker, IEventSerializer, bool)

Represents an implementation of IReducerHandler.

public ReducerHandler(IEventStore eventStore, ReducerId reducerId, EventSequenceId eventSequenceId, IReducerInvoker invoker, IEventSerializer eventSerializer, bool isActive)

Parameters

eventStore IEventStore

IEventStore the reducers belong to.

reducerId ReducerId

The identifier of the reducer.

eventSequenceId EventSequenceId

The EventSequenceId the reducer is for.

invoker IReducerInvoker

The actual invoker.

eventSerializer IEventSerializer

The event serializer to use.

isActive bool

Whether or not reducer should be actively running on the Kernel.

Remarks

Initializes a new instance of the ReducerHandler class.

Properties

CancellationToken

Gets the CancellationToken for the handler.

public CancellationToken CancellationToken { get; }

Property Value

CancellationToken

EventSequenceId

Gets the event sequence the reducer is reducing from.

public EventSequenceId EventSequenceId { get; }

Property Value

EventSequenceId

EventTypes

Gets the event types for the reducer.

public IEnumerable<EventType> EventTypes { get; }

Property Value

IEnumerable<EventType>

Id

Gets the unique identifier of the reducer.

public ReducerId Id { get; }

Property Value

ReducerId

Invoker

Gets the IReducerInvoker that will perform the invocations.

public IReducerInvoker Invoker { get; }

Property Value

IReducerInvoker

IsActive

Gets whether the reducer should be actively running on the Kernel.

public bool IsActive { get; }

Property Value

bool

ReadModelType

Gets the type of the read model.

public Type ReadModelType { get; }

Property Value

Type

Methods

Disconnect()

Disconnect the handler.

public void Disconnect()

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

GetFailedPartitions()

Get any failed partitions for a specific reducer.

public Task<IEnumerable<FailedPartition>> GetFailedPartitions()

Returns

Task<IEnumerable<FailedPartition>>

Collection of FailedPartition, if any.

GetState()

Get the current state of the reducer.

public Task<ReducerState> GetState()

Returns

Task<ReducerState>

The current ReducerState.

OnNext(IEnumerable<AppendedEvent>, object?, IServiceProvider)

Handle next events as bulk.

public Task<ReduceResult> OnNext(IEnumerable<AppendedEvent> events, object? initial, IServiceProvider serviceProvider)

Parameters

events IEnumerable<AppendedEvent>

Collection of AppendedEvent to handle.

initial object

Initial read model value.

serviceProvider IServiceProvider

The IServiceProvider for creating the actual instance of the reducer.

Returns

Task<ReduceResult>

Reduced read model.