Rails Event Store Documentation

website·Indexed 33 days ago

https://railseventstore.org/

Documentation for Rails Event Store, an event sourcing library for Ruby and Rails. Covers core concepts including event subscription via `RailsEventStore::Client#subscribe`, correlation and causation, expected versions, and the `res` command-line interface. Includes guides on event serialization, instrumentation, and using the Browser web interface to inspect streams.

Tokens
116.6K
Snippets
716
Records
828
Agent score
66%

What's inside Rails Event Store

  1. Overview of Event Mappers in RailsEventStore

    A mapper is a pipeline of transformations that converts a domain event object into a record (for storage) and back from a record to a domain event (for reading). Mappers are primarily used for tasks such as encrypting event data or normalizing metadata keys (e.g., converting strings to symbols).
  2. Overview of Event Mappers in RailsEventStore

    A mapper is a pipeline of transformations that converts a domain event object into a record (for storage) and back from a record to a domain event (on read). Mappers are primarily used for tasks such as encrypting event data or normalizing metadata keys (e.g., converting strings to symbols).
  3. Overview of Event Mappers in RailsEventStore

    A Mapper is a pipeline of transformations that converts a domain event object into a record (for storage) and back from a record to a domain event. Mappers are primarily used for tasks such as encrypting event data or ensuring metadata keys are symbolized.
  4. Overview of Rails Event Store capabilities

    Rails Event Store is a framework for Ruby on Rails applications designed to implement Event Sourcing and a Publish-Subscribe bus. It allows developers to decouple core business logic from external concerns using hexagonal architecture, replace ActiveRecord callbacks and observers, and manage side-effects by extracting them from controllers and services into dedicated event handlers. Key use cases include building audit logs, implementing read models, and reacting to events either synchronously or asynchronously.
  5. Overview of Railseventstore CLI commands

    The res command-line interface allows developers to inspect the event store directly from the terminal. Available commands include tools for inspecting streams, viewing individual events, searching across the store, and monitoring live event feeds.
    # Command Summary:
    # stream show   - Event count, version, and first/last event of a stream
    # stream events - Read a stream's events, with filtering, pagination, and --follow
    # event show    - Full detail of one event — data, metadata, timestamps
    # event streams  - Every stream an event is published or linked to
    # search        - Find events across all streams by type, time, or stream
    # stats         - Total count and unique event types, store-wide or per stream
    # trace         - Causation tree for everything sharing a correlation ID
    # watch         - Live feed of new events, grouped by namespace
  6. Overview of RailsEventStore Core Components

    RailsEventStore (RES) is a set of Ruby gems for event sourcing in Rails and Ruby applications, implementing CQRS (Command Query Responsibility Segregation). It consists of four primary internal components:

    1. Client: The main entry point for appending, publishing, and subscribing to events. It orchestrates the flow between application code, storage, and the pub/sub system.
    2. Storage: Manages the persistence and retrieval of events. It stores events as SerializedRecord objects.
    3. Mapper: Transforms domain event Ruby classes into SerializedRecord objects for storage/transmission and vice versa.
    4. Pub/Sub Broker: Manages event subscriptions and delivers published events to their destinations.
  7. Understand Rails Event Store versioning and stability policy

    Rails Event Store follows semantic versioning (semver). However, features explicitly marked as 'experimental' in the documentation may undergo API changes that break backwards compatibility between subsequent minor versions. If you avoid using experimental features, you should not be affected by these breaking changes.
  8. Manage event publishing within application transactions

    RailsEventStore is designed to use the same database as the rest of your Rails application. This allows event publishing to be part of a larger database transaction, ensuring consistency. If an application-level transaction (such as one started in a controller or service object) is rolled back, any events published within that transaction are also rolled back and not persisted to the database.
  9. Manage event publishing with database transactions in RailsEventStore

    RailsEventStore is designed to use the same database as the rest of your application. This allows event publishing to be part of larger application-level transactions (such as those started in a controller or service object). If a transaction is rolled back, any events published within that transaction are also rolled back and not persisted in the database, ensuring data consistency without the need for complex distributed transactions.
  10. Access free community support for Rails Event Store

    Rails Event Store maintains an active community of contributors who report issues, discuss improvements, and provide documentation updates. Users can engage with the community to share learnings and resolve issues.
  11. Understand the RailsEventStore Client architecture

    The Client is the primary entry point for appending, publishing, and subscribing to events. It orchestrates the interaction between application code, storage, and the pub/sub system.

    • RubyEventStore::Client: The base client providing core functionality.
    • RailsEventStore::Client: Inherits from the Ruby client and is optimized for Ruby on Rails. It includes an ActiveRecord-based event repository, an ActiveJob-based asynchronous dispatcher, and instrumentation via ActiveSupport::Notifications.
  12. Understand Rails Event Store versioning and stability

    Rails Event Store follows semantic versioning (semver). However, features explicitly marked as 'experimental' in the documentation may have their APIs change between minor versions, potentially breaking backwards compatibility. If you do not use experimental features, you should not be affected by these API changes.