Skip to content
CAI
Software that uses CAICheck a score

eventsourcing/es4j

55.5

Adequate · 22 September 2026

14.8k

lines of production code

Java

primary language

7

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is an event sourcing library that provides a complete infrastructure for building event-sourced applications, including core abstractions for commands, events, and repositories. It supports multiple storage backends, specifically PostgreSQL and in-memory stores, with robust indexing and query capabilities. The system also features hybrid logical clocking for precise event ordering and includes utilities for schema migrations and rule-based automation.

Features

Add LayoutMigration utility for event transformation

A new LayoutMigration class has been introduced to handle the migration of entity layouts between different versions. This utility facilitates the transformation of old events into new ones and manages the introduction and replacement of layout metadata within the repository.

eventsourcing-migrations/src/main · medium confidence

Add PostgreSQL index implementations for equality and navigable queries

The PostgreSQL storage module now includes new \EqualityIndex\ and \NavigableIndex\ classes to handle attribute indexing. The \EqualityIndex\ supports equality and existence checks, while the \NavigableIndex\ supports range queries (less than, greater than, between) and min/max aggregations. These changes address previous issues with PostgreSQL index initialization, composite key handling for timestamps, and efficient min/max calculation for large datasets.

eventsourcing-postgresql/src/main/java/com/eventsourcing/postgresql/index · high confidence

Add in-memory journal and index engine for testing

Introduced MemoryJournal and MemoryIndexEngine implementations in the eventsourcing-inmem module, providing an in-memory store for events and commands backed by CQEngine. This includes the core in-memory components and a suite of unit tests validating hash, navigable, unique, and general index engine behaviors.

eventsourcing-inmem · high confidence

Add new query protocols for entity state and metadata

Introduced three new protocol interfaces—DeletedProtocol, DescriptionProtocol, and NameProtocol—each providing a method to retrieve the latest associated entity or metadata value, along with a corresponding ModelCollectionQuery implementation to filter collections by that state or attribute. This adds a composable query interface for soft-deleted entities and for filtering by description or name.

eventsourcing-cep/src/main · high confidence

Added Kotlin support and layout analysis for event sourcing

Introduced a new \KotlinSupport\ class and associated test files (\EntityTest\, \LayoutTest\) in the \eventsourcing-kotlin\ module. This adds the ability to analyze Kotlin classes for layout information and supports index discovery via static fields, addressing verbosity and readability issues in index definitions.

eventsourcing-kotlin · medium confidence

Added foodsourcing example with DRL rules for order processing

The foodsourcing example now includes Drools DRL rules in src/main/resources/foodsourcing/Order.drl to automate the order lifecycle. The rules trigger a request for restaurant confirmation when an order is placed, capture payment upon restaurant confirmation, and confirm the order once payment is captured. This adds a rule-based automation layer to the existing command and event structures.

examples/foodsourcing/src/main · high confidence

Initial project setup and documentation

The repository was initialized with essential project files, including a Travis CI configuration (.travis.yml) for continuous integration, a CHANGELOG.md for version history, and a comprehensive README.md explaining the project's purpose and features. Additionally, standard open-source governance and legal files were added: a CONTRIBUTING.md outlining the C4 process, a CONTRIBUTORS file, a LICENSE (MPL-2.0), a LICENSE-HEADER, and a MAINTAINERS.md listing project maintainers. The commit also includes an IntelliJ code style configuration (es4j-intellij-code-style.xml) and updates to the Gradle wrapper scripts (gradlew, gradlew.bat) to improve cross-platform compatibility and build reliability.

(repo-wide) · high confidence

Introduce binary serialization for POJOs in the eventsourcing-layout component

The eventsourcing-layout component now provides a complete binary serialization and deserialization system for Plain Old Java Objects (POJOs). This includes a new \Serialization\ class that manages type handlers and serializers, along with specific binary serializers and deserializers for all supported types (such as \BigDecimal\, \BigInteger\, \Date\, \List\, \Map\, and primitive wrappers). The layout system uses a compact, schema-versioned format that omits property names to reduce size and improve performance, enabling efficient data exchange and storage for eventsourcing-based systems.

eventsourcing-layout · high confidence

Introduce core event types and infrastructure for event sourcing and migrations

This change adds new event classes for the Common Event Pattern (CEP) — specifically Deleted, DescriptionChanged, NameChanged, and Undeleted — to model entity lifecycle and attribute changes. It also introduces core infrastructure classes including a local lock provider, an OSGi-based entity scanner, a scoped query implementation, and a journal persistence adapter. Additionally, it adds migration-specific events (EntityLayoutIntroduced, EntityLayoutReplaced) and a PostgreSQL journal implementation, enabling database-backed event storage and schema versioning.

. · high confidence

Introduces CommandTerminatedExceptionally event type

A new event class, CommandTerminatedExceptionally, has been added to the eventsourcing-core module. This class extends StandardEvent and includes a SimpleIndex for the entity's UUID, conforming to the rfc.eventsourcing.com/spec:9/RIG/\#CommandTerminatedExceptionally layout name.

eventsourcing-core/src/main/java/com/eventsourcing/events · high confidence

Introduces Hybrid Logical Clock (HLC) timestamping for precise event ordering

The system now uses a Hybrid Logical Clock (HLC) implementation to generate timestamps that combine physical time with a logical counter. This ensures that events are ordered correctly even when local clocks drift or restart, preventing issues like repository clocks starting in the future or losing exact last timestamps. The new \HybridTimestamp\ class and \NTPServerTimeProvider\ (which syncs with NTP servers like pool.ntp.org) provide a robust way to handle time-based ordering in distributed scenarios.

eventsourcing-hlc/src/main · high confidence

Introduces new query abstractions and utilities for entity retrieval

The queries module now provides a set of new classes and interfaces to simplify and optimize entity lookups and aggregations. A new \ComparingQuery\ abstract class consolidates logic for min/max operations, with dedicated \Min\ and \Max\ query implementations. A \ModelCollectionQuery\ interface and its \LogicalOperators\ helper allow composing complex collection queries using \and\ and \or\ logic. Additionally, \LatestAssociatedEntryQuery\ and \ModelQueries\ offer streamlined methods for retrieving the latest associated entity and performing standard lookups by ID, reducing boilerplate in the codebase.

eventsourcing-core/src/main/java/com/eventsourcing/queries · high confidence

Introduces new repository components for event sourcing and query handling

The repository module now includes a new CommandConsumer interface, a QuerySubscriber class for managing entity subscriptions and index configuration, and MBean interfaces (JournalMBean, RepositoryMBean) for monitoring. The StandardRepository implementation has been updated to initialize these components, including the introduction of entity layouts and index management during startup.

eventsourcing-repository/src/main · medium confidence

Introduction of the eventsourcing-core API for command and event handling

The eventsourcing-core module now provides a complete set of core interfaces and implementations for building event-sourced applications. This includes the \Command\ and \Event\ domain models, a \Repository\ for managing state and subscriptions, and a \Journal\ for persisting entities. Users can now define commands that produce event streams and handle results, subscribe to entity changes via \EntitySubscriber\, and query the journal using the new \EagerFetching\ and \NotSeenBy\ query options.

eventsourcing-core/src/main/java/com/eventsourcing · high confidence

Removals

Removal of the eventchain-layout serialization component

The eventchain-layout module, which provided versioning, serialization, and deserialization of POJOs for eventchain-based systems, has been removed. This includes the deletion of the Layout, Serializer, Deserializer, and TypeHandler classes, along with their associated test suites. The component's functionality for compact, schema-versioned data exchange is no longer available.

eventchain-layout · high confidence

Behavioural changes

Added PostgreSQL function for hybrid timestamp conversion

A new PostgreSQL stored function, \hybrid\_timestamp\, has been added to convert logical counters and times into PostgreSQL \TIMESTAMP\ values. This function implements the NTP timestamp conversion logic previously handled by Flyway migrations, addressing issues with the previous database migration approach.

eventsourcing-postgresql/src/main/resources · high confidence

PostgreSQL backend: connection pooling, locking, and indexing

The PostgreSQL integration now includes a connection pooling mechanism via HikariCP, a dedicated lock provider using PostgreSQL advisory locks for multi-node deployments, and an index engine supporting equality, unique, and navigable (range) indexes. These changes address previous issues with memory usage during large index additions, the difficulty of using the backend without a pool, and missing index support.

eventsourcing-postgresql/src/main/java/com/eventsourcing/postgresql · high confidence

Refactored index engine architecture with new Attribute and IndexEngine abstractions

The index subsystem has been restructured to improve modularity and support for multiple backends. A new \IndexEngine\ interface and \AbstractIndexEngine\ base class define the contract for index providers, enabling a \CQIndexEngine\ for CQEngine-based indexing and a \CascadingIndexEngine\ that chains multiple index engines together. The \Attribute\ interface and its implementations (\SimpleAttribute\, \MultiValueAttribute\) provide a cleaner way to define indexed properties on entities, replacing the previous static field-based loading mechanism with a more flexible, type-safe approach. This change also introduces \IndexLoader\ and \JavaStaticFieldIndexLoader\ to handle index discovery, allowing for easier extension and configuration of index features.

eventsourcing-core/src/main/java/com/eventsourcing/index · high confidence

Upgraded Gradle wrapper to version 3.3

The Gradle wrapper has been updated from version 2.3 to 3.3, ensuring the project uses a more recent version of the Gradle build tool.

gradle · high confidence

Test coverage

Added JMH benchmarks for repository and journal performance; Added PostgreSQL index tests; Added PostgreSQL integration tests; Added test coverage for the eventsourcing-repository module; Added test fixtures for event sourcing components; Added test fixtures for eventsourcing-repository; Added tests for CEP protocol implementations; Added tests for HybridTimestamp, NTP server time provider, and SerializableComparable behavior; Added tests for event-sourcing query operations; Added tests for layout migration functionality; Added tests for the Foodsourcing example; Added unit tests for core eventsourcing components; Added unit tests for the indexing subsystem.

Dependencies

Initial import of the eventsourcing library modules and build configuration

The project has been rebranded from 'eventchain' to 'eventsourcing', with the root project and all submodules renamed accordingly. This change introduces the Gradle build files for the core modules (core, hlc, inmem, kotlin, migrations, postgresql, repository, cep) and the main build script, establishing the dependency graph and publishing configuration for the new library structure.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 58 → 56 (-2.6)
  • Rubric changed (rubric-2026.08.19 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 83 → 89 (+5.6)
  • Architecture 99 → 97 (-2.3)
  • Maturity 46 → 46 (-0.1)
  • Readiness 50 → 41 (-8.5)
  • Security 89 → 89 (+0.0)

Resolved (26)

  • Address.<init> (cognitive 19) (examples/foodsourcing/src/main/java/foodsourcing/Address.java)
  • Boundary-crossing change coupling: Repository.java ↔ CommandConsumer.java (eventsourcing-core/src/main/java/com/eventsourcing/Repository.java)
  • Change coupling: ListTypeHandler.java ↔ OptionalTypeHandler.java (eventsourcing-layout/src/main/java/com/eventsourcing/layout/types/ListTypeHandler.java)
  • Coverage not included — suite not readable by the collector
  • Dependency hygiene not measured — dependency manifest found but not parsed for hygiene
  • Duplicated block (10 lines × 2) (eventsourcing-core/src/main/java/com/eventsourcing/index/EntityQueryFactory.java)
  • Duplicated block (11 lines × 5) (eventsourcing-postgresql/src/main/java/com/eventsourcing/postgresql/index/NavigableIndex.java)
  • Duplicated block (14 lines × 2) (eventsourcing-postgresql/src/main/java/com/eventsourcing/postgresql/PostgreSQLSerialization.java)
  • Duplicated block (17 lines × 4) (eventsourcing-core/src/main/java/com/eventsourcing/index/EntityQueryFactory.java)
  • Duplicated block (5 lines × 2) (eventsourcing-core/src/main/java/com/eventsourcing/index/EntityQueryFactory.java)
  • Duplicated block (5 lines × 2) (eventsourcing-postgresql/src/main/java/com/eventsourcing/postgresql/PostgreSQLJournal.java)
  • Duplicated block (6 lines × 2) (eventsourcing-layout/src/main/java/com/eventsourcing/layout/comparable/MapComparableSerializer.java)
  • Duplicated block (6 lines × 2) (eventsourcing-postgresql/src/main/java/com/eventsourcing/postgresql/index/NavigableIndex.java)
  • Duplicated block (7 lines × 2) (eventsourcing-layout/src/main/java/com/eventsourcing/layout/binary/MapBinarySerializer.java)
  • Duplicated block (7 lines × 2) (eventsourcing-layout/src/main/java/com/eventsourcing/layout/binary/MapBinarySerializer.java)
  • Duplicated block (7 lines × 2) (eventsourcing-layout/src/main/java/com/eventsourcing/layout/binary/OptionalBinarySerializer.java)
  • Duplicated block (7 lines × 2) (eventsourcing-postgresql/src/main/java/com/eventsourcing/postgresql/index/PostgreSQLAttributeIndex.java)
  • Duplicated block (8 lines × 2) (eventsourcing-layout/src/main/java/com/eventsourcing/layout/binary/OptionalBinarySerializer.java)
  • Duplicated block (8 lines × 2) (eventsourcing-postgresql/src/main/java/com/eventsourcing/postgresql/index/PostgreSQLAttributeIndex.java)
  • Duplicated block (8 lines × 2) (src/jmh/java/com/eventsourcing/jmh/PostgreSQLJournalBenchmark.java)
  • …and 6 more

New (74)

  • ClassTooLong: PostgreSQLAttributeIndex (eventsourcing-postgresql/src/main/java/com/eventsourcing/postgresql/index/PostgreSQLAttributeIndex.java)
  • ClassTooLong: PostgreSQLSerialization (eventsourcing-postgresql/src/main/java/com/eventsourcing/postgresql/PostgreSQLSerialization.java)
  • Dependency hygiene PARTLY measured — Maven/Gradle declarations read, no dependency graph resolved
  • Documentation: written for insiders (docs/core_concepts/entity.md)
  • Duplicated block (10 lines × 2) (eventsourcing-layout/src/main/java/com/eventsourcing/layout/binary/ListBinarySerializer.java)
  • Duplicated block (11 lines × 2) (eventsourcing-layout/src/main/java/com/eventsourcing/layout/binary/ByteArrayBinarySerializer.java)
  • Duplicated block (11 lines × 5) (eventsourcing-postgresql/src/main/java/com/eventsourcing/postgresql/index/NavigableIndex.java)
  • Duplicated block (11–12 lines × 3) (eventsourcing-postgresql/src/main/java/com/eventsourcing/postgresql/index/NavigableIndex.java)
  • Duplicated block (13 lines × 2) (eventsourcing-core/src/main/java/com/eventsourcing/index/EntityQueryFactory.java)
  • Duplicated block (13 lines × 2) (src/jmh/java/com/eventsourcing/jmh/PostgreSQLJournalBenchmark.java)
  • Duplicated block (14 lines × 2) (eventsourcing-postgresql/src/main/java/com/eventsourcing/postgresql/PostgreSQLSerialization.java)
  • Duplicated block (19–20 lines × 2) (eventsourcing-postgresql/src/main/java/com/eventsourcing/postgresql/index/NavigableIndex.java)
  • Duplicated block (23 lines × 4) (eventsourcing-core/src/main/java/com/eventsourcing/index/EntityQueryFactory.java)
  • Duplicated block (26 lines × 2) (eventsourcing-layout/src/main/java/com/eventsourcing/layout/types/StringTypeHandler.java)
  • Duplicated block (27 lines × 2) (eventsourcing-layout/src/main/java/com/eventsourcing/layout/types/FloatTypeHandler.java)
  • Duplicated block (5 lines × 2) (eventsourcing-core/src/main/java/com/eventsourcing/index/EntityQueryFactory.java)
  • Duplicated block (5 lines × 2) (eventsourcing-core/src/main/java/com/eventsourcing/index/EntityQueryFactory.java)
  • Duplicated block (5 lines × 2) (eventsourcing-core/src/main/java/com/eventsourcing/index/EntityQueryFactory.java)
  • Duplicated block (5 lines × 2) (eventsourcing-core/src/main/java/com/eventsourcing/index/EntityQueryFactory.java)
  • Duplicated block (5 lines × 2) (eventsourcing-core/src/main/java/com/eventsourcing/index/EntityQueryFactory.java)
  • …and 54 more

Architecture

  • Containers 0 added · 0 removed · contexts 8 added · 1 removed · edges 11 added · 0 removed

Added bounded contexts (8)

  • eventsourcing
  • eventsourcing-cep
  • eventsourcing-core
  • eventsourcing-layout
  • eventsourcing-migrations
  • eventsourcing-postgresql
  • eventsourcing-repository
  • foodsourcing

Removed bounded contexts (1)

  • .

Added dependency edges (11)

  • eventsourcing → eventsourcing-core
  • eventsourcing-cep → eventsourcing-core
  • eventsourcing-core → eventsourcing-layout
  • eventsourcing-migrations → eventsourcing-core
  • eventsourcing-migrations → eventsourcing-layout
  • eventsourcing-postgresql → eventsourcing-core
  • eventsourcing-postgresql → eventsourcing-layout
  • eventsourcing-repository → eventsourcing-core
  • foodsourcing → eventsourcing-cep
  • foodsourcing → eventsourcing-core
  • foodsourcing → eventsourcing-layout

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

eventsourcing/es4j was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 22 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 34ce67b31b41cc9894410cb5e957968965b1e0b7 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-90d5d2fe38ee.