Wow Framework

repository·main·Indexed 43 days ago

https://github.com/ahoo-wang/wow

A modern reactive CQRS and Event Sourcing microservice development framework based on Domain-Driven Design (DDD). Version 9.1.3 provides tools to turn domain decisions into observable, traceable flows, featuring a dedicated compensation module for handling event processing failures and an operational dashboard for monitoring and managing retry specifications.

Tokens
361.3K
Snippets
784
Records
1.4K
Agent score
55%

What's inside Wow

  1. What is Wow: Domain Model as a Service

    main

    Wow is a reactive CQRS (Command Query Responsibility Segregation) and Event Sourcing framework designed to make domain decisions explicit, testable, and traceable. It transforms every write operation into an observable domain pipeline:

    HTTP Command → Aggregate Decision → Domain Event → Replayed State → Projection / Saga

    When to use Wow

    Use Wow when your business rules are complex and require:

    • State history (Event Sourcing)
    • Multiple read models (Projections)
    • Cross-aggregate workflows (Sagas)

    Note: For simple CRUD operations where a single database transaction suffices, the overhead of event evolution and eventual consistency may not be justified.

  2. Overview of Wow Core

    main

    wow-core is the reactive runtime core of the Wow framework. It provides the public interfaces and foundational implementations for command processing, event sourcing, message dispatching, waiting stages, projections, and Sagas.

    When to use wow-core directly

    • When implementing a domain runtime or a non-Spring integration where you need to directly use CommandGateway, EventStore, the message bus, or the Dispatcher.
    • When developing extension modules that need to hook into the Wow runtime lifecycle.

    Note: For Spring Boot services, it is recommended to use wow-spring-boot-starter instead of manually assembling wow-core components.

  3. Overview of the Query Execution Contracts Implementation Plan

    main

    The Query Execution Contracts implementation plan aims to fix isolation issues in Elasticsearch (ES) cursor subscriptions and handle MongoDB projection results where primary keys might be absent.

    Key Architectural Changes:

    • Elasticsearch: Retains request compilation and token validation but defers client-side searching to ensure each subscription triggers an independent search.
    • MongoDB: Two built-in query backends share a single internal mapping function. If the primary key is present, it reuses the existing strict renaming function; if the primary key is absent, it performs a direct JSON conversion.
    • Unchanged Components: Gateway, Schema, and persistence conversion logic remain unchanged.

    Tech Stack:

    • Kotlin, JVM 17, Reactor
    • Spring Data Elasticsearch 6.1.1
    • MongoDB reactive driver
    • Testing: JUnit, MockK, FluentAssert, Testcontainers
  4. Overview of Wow Event Compensation

    main

    The compensation module records failures in event handler functions. It allows for the re-delivery of original events via automatic scheduling or manual intervention.

    Important Constraints:

    • It does not roll back databases.
    • It does not undo already committed events.
    • It does not automatically generate reverse business operations (compensating transactions).

    Users must ensure that business handlers are idempotent and can handle side effects (like payments or notifications) that may have already occurred before a retry.

  5. Overview of Wow Framework

    main

    Wow is a reactive CQRS (Command Query Responsibility Segregation) and Event Sourcing framework designed for Kotlin and Java. It formalizes business logic into a specific execution flow:

    Command → Aggregate decision → Domain event → Sourced state

    Instead of traditional CRUD, Wow focuses on making business intent explicit through commands and preserving state changes through persisted events. This allows projections, sagas, and other processors to react to the event stream. It is suitable for both microservices and modular monoliths where rich domain rules and state history are required.

  6. Select the appropriate Wow documentation for your task

    main

    Wow documentation is organized by intent. Use the following mapping to find what you need:

    • Guides: Use these to understand the why and how of completing specific tasks (e.g., modeling aggregates, building query models).
    • Reference: Use these for exact facts, including Configuration Reference, Examples, and Ecosystem.
    • API Documentation: Access Kotlin and Java symbols and signatures via the top navigation (powered by Dokka).
    • Onboarding: Follow role-specific paths (Architect, Contributor, Executive, Product Manager) located in onboarding.
    • Articles: Read these to understand specific technical trade-offs through concrete problem scenarios.

    Warning: If prose documentation conflicts with the actual code (configuration classes, public contracts, or tests), the source code is the single source of truth.

  7. Core features of the Wow framework

    main

    Wow is a modern reactive CQRS architecture microservice development framework based on DDD (Domain-Driven Design) and Event Sourcing. Key capabilities include:

    • Domain Model as a Service: Define commands, events, and state around the domain model. Wow automates OpenAPI metadata generation and wires the runtime pipeline to reduce infrastructure boilerplate.
    • Test Suite: Uses a Given->When->Expect pattern to verify commands, events, and state directly.
    • Scalability & Reactive Programming: Uses Reactor for non-blocking work. Abstractions for Aggregates, Event Stores, and Messaging reduce domain coupling to storage topology.
    • Distributed Transactions (Saga): Provides the Saga orchestration pattern to manage complex multi-service transaction processes.
    • Event Compensation Automation: Automatically records event-processing failures and provides retry, notification, and visual operations for verifiable recovery flows.
    • End-to-End Observability: Integrated OpenTelemetry observation points for commands, events, projections, sagas, and storage.
    • Business Intelligence: Provides business-semantic data via state events and commands, including generated ClickHouse sync scripts.
  8. Select Wow modules by responsibility

    main

    When building an application with Wow, you can choose modules based on their primary responsibility. Use the following mapping to decide which modules to include in your project:

    ModulePrimary responsibility
    wow-apiPublic command, event, naming, header, and AggregateId contracts
    wow-coreCommandGateway, dispatchers, EventStore interfaces, event sourcing, projections, sagas, wait chains
    wow-queryQuery models, schema resolution, snapshot/event query interfaces
    wow-modelsRepository shared models and KSP-generated examples
    wow-springSpring container bridge and Query Gateway registration
    wow-spring-boot-starterCore auto-configuration and optional feature variants
    wow-kafkaKafka Command/DomainEvent/StateEvent buses
    wow-mongoMongo EventStore, SnapshotStore, PrepareKey, and query backends
    wow-redisRedis buses, EventStore, SnapshotStore, and PrepareKey
    wow-elasticsearchElasticsearch EventStore, SnapshotStore, and query backends
    wow-webfluxBuilt-in command, event, state, query, and operation route handlers
    wow-opentelemetryOpenTelemetry instrumenters for Wow flows
    wow-cosecCoSec request-context propagation and query-space rewriting
    wow-compilerKSP metadata and API-contract generation (use with ksp(...), never as runtime)
    wow-schemaJSON Schema generation
    wow-openapiBuilt-in route and OpenAPI contract generation
    wow-biBI/ClickHouse synchronization script generation
    wow-testAggregateSpec and SagaSpec DSL
    wow-tckAdapter contracts and Testcontainers fixtures
    wow-mockMock and delayed storage support (tests only)
    wow-apiclientCoApi/Wow REST API client
    wow-cocacheCoCache projection-cache integration
    wow-bom / wow-dependenciesVersion alignment (BOM/Platform)
  9. Definition of Done for EventStream Aggregation and Query Schema Design

    main

    The implementation of the EventStream aggregation and query schema design is considered complete when the following criteria are met:

    • Unified Schema Provider: All query forms for EventStream must utilize the same EVENT_STREAM Schema Provider.
    • Unified Aggregation Execution: EventStream aggregation is executed through a handler/proxy/filter chain. Behavior for MongoDB and Elasticsearch must be consistent via a shared TCK (Technology Compatibility Kit).
    • Schema Consistency: The system Schema must match the authoritative serialized wire shape. The payload must be inferred from the known event types of the current aggregation root.
    • Compatibility and Error Handling:
      • The default compatibility mode does not tighten/restrict undeclared payload fields.
      • Strict mode and capability errors must follow a fail-closed pattern.
    • No Redundancy: There should be no duplicated EventStream backend Schema Adapters or aggregation compilers.
    • Minimal Footprint: No new EventStream HTTP/OpenAPI routes, dependencies, configuration items, or modules should be added.
  10. Understand the Java Bank Transfer Saga Example

    main

    This example demonstrates how to implement account business logic using Java Aggregates and coordinate cross-account transfers using a Wow stateless Saga.

    Workflow

    • Success Path: Prepared -> Entry -> AmountEntered -> Confirm.
    • Compensation Path (Failure): If the target account is frozen, the system executes EntryFailed -> UnlockAmount to return the locked amount to the source account.

    Note: This is an event-driven compensation mechanism, not a cross-aggregate database transaction.

    Module Structure

    ModuleResponsibility
    example-transfer-apiCommands, events, and the publishing language for account
    example-transfer-domainDecision making and sourcing for Account / AccountState, and the TransferSaga
    example-transfer-serverSpring Boot entry point, assembling WebFlux and OpenAPI
  11. Understand the Pure-Create MongoDB/Redis Profile Evidence

    main

    This documentation provides profiling evidence for the MongoDB and Redis execution paths during a fresh aggregate command through PROCESSED. It is used to identify optimization candidates following the merge of the SENT fast path.

    Note: The throughput values provided here are for diagnostic purposes only. For official throughput evidence, refer to the paired A/B test package: ../2026-07-24-command-wait-sent-paired-ab.

  12. What is Wow and how does it work?

    main

    Wow is a reactive CQRS (Command Query Responsibility Segregation) and Event Sourcing framework designed for building explicit, testable, and traceable domain models. It transforms every write operation into an observable domain flow:

    HTTP command → aggregate decision → domain event → sourced state → projection / saga

    Developers define commands, events, aggregate rules, and sourcing handlers. Wow provides the underlying infrastructure, including:

    • Reactive command pipelines
    • Event persistence and snapshots
    • Wait stages and projections
    • Sagas and generated metadata
    • WebFlux routes
    • A Given → When → Expect test DSL

    When to use Wow: Use Wow when your application requires complex business rules, state history, multiple read models, or cross-aggregate workflows that justify the overhead of Event Sourcing. For simple CRUD operations where a single database transaction is sufficient, the costs of event evolution and eventual consistency may outweigh the benefits.