Skip to content

v0.4.0

Choose a tag to compare

@github-actions github-actions released this 02 Oct 17:15
· 31 commits to main since this release

Middleware integrations with domain semantics: aggregate locks, duplicate-submit protection and rate limits on Redisson, scheduled jobs that run on one instance, the error contract in OpenAPI docs, Flyway migrations in generated projects, and ddk-test for domain assertions and container presets.

Added

  • ddk-concurrency-starter: @AggregateLock holds a Redisson lock per aggregate instance around the method's transaction, @Idempotent rejects a request key that was already submitted, and AggregateLocks is the programmatic entry point
  • @RateLimit in ddk-concurrency-starter gives each key, such as a user or tenant, a budget of calls per period shared by all instances; over the limit it throws RateLimitedException (RATE_LIMITED), which the web starter maps to 429
  • AggregateBusyException (AGGREGATE_BUSY) and DuplicateRequestException (DUPLICATE_REQUEST) in ddk-core; the web starter maps both to 409 Conflict
  • The web starter documents the error contract when springdoc is on the classpath: every operation gets 400 / 409 / 500 responses with the failed ApiResponse body, and components.schemas.ErrorCode lists CommonError plus every ErrorCode enum in the application's packages with its message. ddk.web.openapi=false turns it off. The BOM manages springdoc 3.1; the user example serves Swagger UI
  • ddk-test: DdkAssertions for aggregates (hasRaisedExactly, hasRaised, hasRaisedNoEvents) and rejected operations (assertThatRejected(...).withCode(...)), and DdkContainers presets for Redis, MySQL and RocketMQ. Generated projects and the example depend on it with test scope
  • ddk-job-starter: turns on @Scheduled and wires ShedLock with a Redis lock, so a job marked @SchedulerLock runs on one instance at a time; defaults under ddk.job.lock.*. The optional rule CommonArchRules.SCHEDULED_JOBS_MUST_BE_LOCKED fails the build when a @Scheduled method has no @SchedulerLock
  • CommonArchRules.SCHEDULED_JOBS_MUST_RESIDE_IN_ADAPTER keeps @Scheduled and @XxlJob methods in the adapter layer, so scheduled jobs reach the domain only through application services; generated projects and the example check it

Changed

  • Generated projects and the user example manage their schema with Flyway (spring-boot-starter-flyway, scripts in src/main/resources/db/migration) instead of schema.sql; the generated AGENTS.md and skills tell agents to add a new migration per schema change