v0.4.0
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:@AggregateLockholds a Redisson lock per aggregate instance around the method's transaction,@Idempotentrejects a request key that was already submitted, andAggregateLocksis the programmatic entry point@RateLimitinddk-concurrency-startergives each key, such as a user or tenant, a budget of calls per period shared by all instances; over the limit it throwsRateLimitedException(RATE_LIMITED), which the web starter maps to 429AggregateBusyException(AGGREGATE_BUSY) andDuplicateRequestException(DUPLICATE_REQUEST) inddk-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
ApiResponsebody, andcomponents.schemas.ErrorCodelistsCommonErrorplus everyErrorCodeenum in the application's packages with its message.ddk.web.openapi=falseturns it off. The BOM manages springdoc 3.1; the user example serves Swagger UI ddk-test:DdkAssertionsfor aggregates (hasRaisedExactly,hasRaised,hasRaisedNoEvents) and rejected operations (assertThatRejected(...).withCode(...)), andDdkContainerspresets for Redis, MySQL and RocketMQ. Generated projects and the example depend on it with test scopeddk-job-starter: turns on@Scheduledand wires ShedLock with a Redis lock, so a job marked@SchedulerLockruns on one instance at a time; defaults underddk.job.lock.*. The optional ruleCommonArchRules.SCHEDULED_JOBS_MUST_BE_LOCKEDfails the build when a@Scheduledmethod has no@SchedulerLockCommonArchRules.SCHEDULED_JOBS_MUST_RESIDE_IN_ADAPTERkeeps@Scheduledand@XxlJobmethods 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 insrc/main/resources/db/migration) instead ofschema.sql; the generatedAGENTS.mdand skills tell agents to add a new migration per schema change