Cratis Chronicle reactors — subscribe to external stores
Cratis Chronicle can route a C# reactor to another event store’s events using [EventStore] metadata. The declaration selects a local inbox sequence and creates or reuses the subscription that forwards matching events from the source store’s outbox. Your handler reads those forwarded events from the inbox.
Automatic inbox routing
Section titled “Automatic inbox routing”If you own the event contracts, declare their source with [EventStore("...")] on each event type or on their assembly. With no explicit event sequence on the reactor, Chronicle infers the inbox from that metadata.
using Cratis.Chronicle.Events;using Cratis.Chronicle.Reactors;
[EventType][EventStore("fulfillment-service")]public record ExternalEventStoreShipmentDispatched(Guid OrderId, string TrackingNumber);
public class ExternalEventStoreFulfillmentReactor : IReactor{ public Task ShipmentDispatched(ExternalEventStoreShipmentDispatched @event, EventContext context) => Task.CompletedTask;}Kotlin does not support this workflow yet.Java does not support this workflow yet.Elixir does not support this workflow yet.TypeScript does not support this workflow yet.The event type declares fulfillment-service, so the reactor observes inbox-fulfillment-service. The source must publish the events to its outbox; this subscription does not forward events from its event log. See Implicit Event Store Subscriptions for the producer and consumer setup.
Keep inferred sources to one store per reactor. Conflicting event-type sources throw MultipleEventStoresDefined at startup. If the inferred source is the reactor’s own store, Chronicle selects the local event log instead of an inbox.
Observer-level EventStore for missing event metadata
Section titled “Observer-level EventStore for missing event metadata”If you cannot change the event contracts, put [EventStore] on the reactor instead. This selects the source for the reactor without requiring the attribute on its event types.
using Cratis.Chronicle.Events;using Cratis.Chronicle.Reactors;
[EventType]public record ExternalEventStoreUserInvited(Guid UserId);
[EventStore("identity-service")][Reactor]public class ExternalEventStoreUserInvitedReactor : IReactor{ public Task Invited(ExternalEventStoreUserInvited @event, EventContext context) => Task.CompletedTask;}Kotlin does not support this workflow yet.Java does not support this workflow yet.Elixir does not support this workflow yet.TypeScript does not support this workflow yet.Here, the reactor observes inbox-identity-service, and Chronicle creates or reuses the outbox-to-inbox subscription for identity-service.
Source event store from configuration
Section titled “Source event store from configuration”When configuration supplies the source name at runtime, register the reactor with ReactorRegistrationOptions.FromEventStore(name) instead of adding an [EventStore] attribute.
using Cratis.Chronicle;using Cratis.Chronicle.Events;using Cratis.Chronicle.Reactors;using Cratis.Chronicle.Registrations;
[EventType]public record ConfiguredSourceUserInvited(Guid UserId);
public class ConfiguredSourceUserInvitedReactor : IReactor{ public Task Invited(ConfiguredSourceUserInvited @event) => Task.CompletedTask;}
public static class ConfiguredSourceRegistration{ public static void Register(ChronicleOptions options, string hostEventStore) => options.ExplicitArtifacts.RegisterReactor<ConfiguredSourceUserInvitedReactor>( ReactorRegistrationOptions.FromEventStore(hostEventStore));}The supplied name selects inbox-<store> and creates the same implicit subscription. A different [EventStore] declaration or an explicit event sequence conflicts with this option.
Unlike source inference from event types, both the reactor-level attribute and the registration option always select inbox-<store>, even when the source equals the current store. In that case, Chronicle does not create a subscription.
Implicit combined event type filtering
Section titled “Implicit combined event type filtering”Chronicle combines the event types handled by participating reactors and reducers into one subscription filter per source event store. It also merges event types requested by projections. Only event types in that combined filter are forwarded from the source outbox to the target inbox, so adding another observer can expand what the shared subscription forwards.
Explicit event sequence is not allowed with observer EventStore
Section titled “Explicit event sequence is not allowed with observer EventStore”A reactor-level source declaration already chooses the inbox sequence. Do not combine [EventStore("...")] or ReactorRegistrationOptions.FromEventStore(name) with any of these explicit sequence declarations:
[EventSequence("...")][EventLog][Reactor(eventSequence: "...")]
These combinations throw EventStoreCannotBeCombinedWithExplicitEventSequence at runtime; registration options fail when the store is created. Analyzer rule CHR0013 also catches the attribute combination at compile time, but does not check registration options.
Forwarded metadata
Section titled “Forwarded metadata”Inbox forwarding preserves append tags along with event-source and stream-route metadata, so tag filters can select forwarded events. Events forwarded by earlier releases that dropped tags remain untagged; upgrading does not backfill them.
See also
Section titled “See also”For shared contracts, follow the implicit-subscription setup below. Choose explicit subscriptions when you need to manage the forwarding filter or subscription lifecycle yourself.