Skip to content

CHR0008: Reactor event types must be from the same event store

A reactor subscribes to one event store’s event stream. Handling events from multiple event stores would require multiple subscriptions, which Chronicle does not support for a single reactor. Ensure all event types in this reactor are from the same event store, or split it into separate reactors—one per event store.

Error

using Cratis.Chronicle.Events;
using Cratis.Chronicle.Reactors;
[EventType("order-placed")]
[EventStore("orders")]
public record Chr0008ViolationOrderPlaced(decimal Amount);
[EventType("shipment-scheduled")]
[EventStore("shipping")]
public record Chr0008ViolationShipmentScheduled(string Destination);
// Error CHR0008: Reactor 'Chr0008ViolationOrderProcessor' handles event types from
// multiple event stores: "orders", "shipping". All event types in a reactor must
// originate from the same event store.
public class Chr0008ViolationOrderProcessor : IReactor
{
public void Handle(Chr0008ViolationOrderPlaced @event) { }
public void Handle(Chr0008ViolationShipmentScheduled @event) { }
}
using Cratis.Chronicle.Events;
using Cratis.Chronicle.Reactors;
[EventType("order-placed")]
[EventStore("orders")]
public record Chr0008FixOrderPlaced(decimal Amount);
[EventType("order-shipped")]
[EventStore("orders")]
public record Chr0008FixOrderShipped(string Destination);
// All event types belong to the same event store: "orders".
public class Chr0008FixOrderProcessor : IReactor
{
public void Handle(Chr0008FixOrderPlaced @event) { }
public void Handle(Chr0008FixOrderShipped @event) { }
}

Chronicle routes events from a single event store to each observer. A reactor that declares handlers for events from different stores would require Chronicle to multiplex subscriptions, which the observer model does not support. This rule catches the misconfiguration at compile time instead of failing when the client connects.

Split reactors that genuinely need to react to events from different stores into one reactor per store, each subscribing to its own event stream.

  • CHR0009: Reducer event types must be from the same event store — the same contract for reducers.
  • CHR0010: Model-bound projection event types must be from the same event store — the same contract for model-bound projections.
  • CHR0011: Declarative projection event types must be from the same event store — the same contract for fluent projections.