Skip to content

0.40.25

Pre-release
Pre-release

Choose a tag to compare

@jeppec jeppec released this 04 Aug 04:37
· 88 commits to main since this release
5dc41e9

Essentials v0.40.25 Release Notes

Overview

This release introduces significant enhancements to durable queues with intelligent polling optimization and major SQL query performance improvements, experimental event sourcing improvements, enhanced security features, and comprehensive documentation updates.
The release focuses on performance optimization and developer experience improvements, with large performance gains in DurableQueue operations through new query optimizations.

🚀 New Features

Durable Queues Optimization

CentralizedQueuePollingOptimizer

  • New intelligent polling backoff system for CentralizedMessageFetcher
  • Configurable parameters:
    • initialDelayMs: Base delay after seeing work (e.g., 100ms)
    • maxDelayMs: Maximum backoff cap (e.g., 30,000ms)
    • backoffFactor: Multiplier on empty polls (e.g., 2.0)
    • jitterFraction: ±fraction for jitter (e.g., 0.1 = ±10%)
  • Benefits: Reduces resource consumption by intelligently backing off polling for queues that are empty and experience little activity
  • Thread-safe implementation with atomic operations for concurrent environments

Enhanced Queue Consumer

  • Improved durability and logging in queue consumer operations
  • New GetNextMessageReadyForDelivery SQL query that optimizes time and resources
  • Refactored SimpleQueuePollingOptimizer into its own top-level class for better maintainability

DurableQueue SQL Query Optimizations

  • 🚀 Large Performance Improvements: New query optimizations addressing reported DurableQueue performance issues. More improvements will follow in the next releases.
  • New useOrderedUnorderedQuery flag: Activates optimized SQL queries for significantly better performance
    • Default: true (enabled by default for optimal performance)
    • Configuration: essentials.durable-queues.use-ordered-unordered-query=true
  • New Spring Boot DurableQueues Configuration:
    essentials.durable-queues.use-centralized-message-fetcher=true (default)              - added in version 0.40.24
    essentials.durable-queues.centralized-message-fetcher-polling-interval=20ms (default) - added in version 0.40.25
    essentials.durable-queues.centralized-polling-delay-back-off-factor=1.5 (default)     - added in version 0.40.25
    essentials.durable-queues.use-ordered-unordered-query=true (default)                  - added in version 0.40.25
📊 Performance Benchmarks

Large performance improvements with new query optimizations:

🎯 Performance Gains when using essentials.durable-queues.use-ordered-unordered-query=true

  • Ordered workload: ~17x faster (94% improvement)
  • Unordered workload: ~5x faster (79% improvement)
  • Mixed workload: ~19x faster (95% improvement)

🎯 Decreased Database load when using the CentralizedQueuePollingOptimizer

  • If essentials.durable-queues.use-centralized-message-fetcher=true then the CentralizedQueuePollingOptimizer is automatically configured.
  • Use the essentials.durable-queues.centralized-message-fetcher-polling-interval, essentials.durable-queues.centralized-polling-delay-back-off-factor and essentials.durable-queues.max-polling-interval
    to adjust CentralizedMessageFetcher's initialDelayMs, backoffFactor and maxDelayMs

Inbox Enhancements

  • Automatic UnitOfWork integration: If Inbox has access to UnitOfWorkFactory, addMessageReceived calls are automatically performed in a UnitOfWork
  • Improved transaction handling for message processing

PostgreSQL TTL Management

  • 🆕 Time-to-Live (TTL) management feature for PostgreSQL databases
  • Automatic cleanup of expired records based on configurable TTL policies
  • Scheduling framework integration with PostgreSQL pg_cron support
  • Flexible TTL configuration for different data types and retention requirements

Event Store Subscription Architecture Improvements

  • Major refactoring of EventStoreSubscriptionManager (#14)
  • Moved inner classes to top-level classes for better maintainability and testability:
    • AbstractEventStoreSubscription - Common functionality base class
    • ExclusiveAsynchronousSubscription - Dedicated class for exclusive async subscriptions
    • ExclusiveInTransactionSubscription - Dedicated class for exclusive transactional subscriptions
    • NonExclusiveAsynchronousSubscription - Dedicated class for non-exclusive async subscriptions
    • NonExclusiveBatchedAsynchronousSubscription - Dedicated class for batched async subscriptions
    • NonExclusiveInTransactionSubscription - Dedicated class for non-exclusive transactional subscriptions
    • PersistedEventSubscriber - Dedicated subscriber interface
  • Improved code organization and separation of concerns
  • Enhanced maintainability with cleaner class hierarchy

Performance Monitoring Enhancements

  • SQL execution time logger for database performance monitoring
  • Query tagging features for better SQL query identification and debugging
  • Enhanced observability of database operations

Kotlin Event Sourcing Enhancements

  • Enhanced logging in DeciderCommandHandlerAdapter with detailed event information:
    • Aggregate type and ID
    • Event type and order
    • Global event order

Java Event Sourcing Enhancements

EventStreamDecider (Experimental)

  • ⚠️ Experimental API - Subject to change in future releases
  • Simplified event sourcing interface focusing on processing commands against event streams
  • Key characteristics:
    • Event-centric: Works directly with event streams rather than maintaining state
    • Functional: Pure functions with predictable input/output
    • Idempotent: Safe to call multiple times with same input
    • Stateless: No internal state management
  • Perfect for Event Modeling and slicing implementation
  • Supports Open/Closed Principle - only events are shared across slices
  • Integration support via EventStreamDeciderCommandHandlerAdapter
  • Testing framework with GivenWhenThenScenario for behavior-driven testing

Enhanced HandlerResult (related to Decider)

  • New fold method for functional-style result handling
  • Improved error handling and success case management
  • Better integration with functional programming patterns

Security and Validation Enhancements

PostgresqlUtil Improvements

  • More extensive SQL identifier validation supporting PostgreSQL naming conventions
  • New or Updated PostgresqlUtil validation methods:
    • isValidSqlIdentifier(String): Validates basic SQL identifiers
    • isValidQualifiedSqlIdentifier(String): Validates schema.table format
    • isValidFunctionName(String): Validates function names
    • checkIsValidTableOrColumnName(String): Validates table/column names

🛠️ API Improvements

EventJSON Enhancements

  • New type-safe deserialization method: deserialize(Class<T>) for improved flexibility and usability

Functional Enhancements

  • New Quad-related functional utilities for working with 4-tuples
  • Enhanced functional programming support

📚 Documentation Updates

Comprehensive README Updates

  • Interceptor Pattern Support documentation with usage guidelines
  • Code example corrections: Fixed logical type reference from CURRENCY_CODE to ORDER_ID
  • Enhanced security documentation with detailed recommendations
  • Improved Aggregate-Id documentation with security considerations

EventStreamDecider Documentation

  • Detailed usage patterns and decision matrix for aggregate patterns
  • Event Modeling integration guide
  • Comprehensive examples and best practices
  • Testing strategies with GivenWhenThenScenario

Dependency Updates

Runtime Dependencies

  • kotlin: 2.1.20 → 2.1.21
  • spring-boot: 3.3.11 → 3.3.13
  • spring-framework-bom: 6.1.19 → 6.1.21
  • reactor-bom: 2023.0.17 → 2024.0.8
  • spring-data-mongodb: 4.3.11 → 4.3.13
  • spring-data-jpa: 3.3.11 → 3.3.13
  • postgresql: 42.7.5 → 42.7.7
  • log4j-to-slf4j: 2.24.3 → 2.25.1
  • micrometer: 1.13.13 → 1.13.15
  • micrometer-tracing: 1.3.11 → 1.3.13
  • netty-bom: 4.2.0.Final → 4.2.2.Final
  • xmlunit-core: 2.10.0 → 2.10.3

Test Dependencies

  • junit-bom: 5.12.2 → 5.13.4
  • testcontainers-bom: 1.21.0 → 1.21.3
  • jdbi3-bom: 3.49.3 → 3.49.5
  • jackson-bom: 2.19.0 → 2.19.2
  • mockito-bom: 5.17.0 → 5.18.0

Maven Plugin Updates

  • maven-clean-plugin: 3.4.1 → 3.5.0
  • maven-enforcer-plugin: 3.5.0 → 3.6.1
  • dependency-check-maven: 12.1.1 → 12.1.3
  • flatten-maven-plugin: 1.7.0 → 1.7.2
  • maven-gpg-plugin: 3.2.7 → 3.2.8

New Dependencies Added

  • vaadin: 24.7.12 (new dependency management)
  • spring.security: 6.3.10 (new dependency management)
  • tomcat-embed: 10.1.43 (new dependency management)
  • central-publishing-maven-plugin: 0.8.0 (replaces nexus-staging-maven-plugin)

Pull Requests

  • Introduce Essentials Api´s: by @lcramon-tw in #3
  • queue_tracing by @jeppec in #4
  • Vaadin UI by @lcramon-tw in #5
  • Added a deprecated AggregateType class with dk.cloudcreate for backward compatibility with existing persisted messages using AggregateType as message payload (e.g. EventReferenceOrderedMessage). by @jeppec in #6
  • Add Essentials Admin UI Spring Boot Starter by @lcramon-tw in #7
  • Add scheduling framework with PostgreSQL pg_cron integration by @lcramon-tw in #8
  • Add junit test summary step to github pipeline by @lcramon-tw in #12
  • Add SQL execution time logger and query tagging features by @lcramon-tw in #11
  • Introduce Time-to-Live (TTL) management feature for Postgresql in Essentials by @lcramon-tw in #10
  • Refactor EventStoreSubscriptionManager moving inner classes to top level classes. Introducing AbstractEventStoreSubscription for common functionality. by @lcramon-tw in #14
  • Introduce CentralizedQueuePollingOptimizer to add polling frequency backoff for CentralizedMessageFetcher. New GetNextMessageReadyForDelivery sql query that optimizes time and resources. by @lcramon-tw in #15
  • Updated or Added the <name> fields in all pom.xml files. by @jeppec in #17

New Contributors

Full Changelog: 0.40.24...0.40.25