Skip to content

Release v20.50.0

Choose a tag to compare

@github-actions github-actions released this 08 Jul 16:25
16b1bdb

Added

  • Reactors can return a [Command] (or a collection of commands) from a handler method and Arc executes them automatically through the command pipeline — no need to inject ICommandPipeline for simple follow-up actions.

Behavior

  • Returned commands run sequentially within a dedicated service scope and go through full validation, authorization, and Handle().
  • Execution stops at the first command that fails; the reactor then fails and Chronicle pauses the partition for retry — consistent with the built-in event side-effect handlers.
  • Returning multiple commands is a convenience, not a transaction: there is no rollback, so events appended by earlier commands remain if a later one fails. For all-or-nothing semantics, model it as a single command.

Usage

[Command]
public record CreateSearchIndex(BookId BookId, string Title)
{
    public Task Handle(/* dependencies */) => /* ... */;
}

// A normal Chronicle reactor — dispatch is by the first parameter type,
// and the returned command is executed as a side effect.
public class CatalogIndexer : IReactor
{
    public CreateSearchIndex BookAdded(BookAddedToCatalog @event) =>
        new(@event.BookId, @event.Title);
}