Skip to content

feat: Quarkus support for the Process Engine Worker (#265) - #268

Draft
Hafflgav wants to merge 1 commit into
developfrom
Hafflgav/plan-quarkus-adapter-issue-265
Draft

feat: Quarkus support for the Process Engine Worker (#265)#268
Hafflgav wants to merge 1 commit into
developfrom
Hafflgav/plan-quarkus-adapter-issue-265

Conversation

@Hafflgav

Copy link
Copy Markdown
Contributor

Closes #265

Summary

Extracts a framework-independent core from the Spring Boot starter, keeps the starter backward compatible and adds a Quarkus extension with build-time worker discovery. JPA-based idempotency is now available for both frameworks.

Module layout

Module Artifact Notes
core/ process-engine-worker-core Kotlin, no Spring/Quarkus dependency: annotations, ProcessEngineWorkerRegistrar, resolvers, exceptions, metrics, idempotency logic, SPIs TransactionalExecutor / AfterCommitHook / TransactionalMethodDetector
spring-boot-starter/ process-engine-worker-spring-boot-starter Thin layer over core; same class names, constructor, .imports and properties
idempotency-registry-jpa/ process-engine-worker-idempotency-registry-jpa Framework-free JPA registry (entity/converter moved with unchanged FQCNs and schema, EntityManagerJpaIdempotencyRegistry, pluggable Java/Jackson serializer)
spring-boot-idempotency-registry-jpa/ unchanged Now on top of the shared JPA module
quarkus/runtime + quarkus/deployment process-engine-worker-quarkus (+ -deployment) Quarkus extension (runtime Kotlin, deployment Java)

Quarkus extension

  • Jandex discovery of @ProcessEngineWorker methods; worker classes need no scope annotation (auto @Singleton, unremovable).
  • Registration in a RUNTIME_INIT recorder step (ServiceStartBuildItem), i.e. before any StartupEvent observer and therefore before the C8 Quarkus adapter subscribes its job workers.
  • Build-time validation: non-public/static/abstract worker methods, workers exposed via @Produces, duplicate topics (per tenant), Kotlin dual constructors, vetoed classes, topic/value conflicts.
  • Optional integrations detected at build time: JTA transactions (quarkus-narayana-jta), Micrometer metrics, JPA idempotency (quarkus-hibernate-orm + the JPA module).
  • All provided beans are @DefaultBeans, replaceable by a user @Produces.
  • Config keys identical to Spring: dev.bpm-crafters.process-api.worker.{enabled,complete-tasks-before-commit,remove-task-result-on-completion,tenant-id}.
  • Native image: worker classes, @Variable types and converters are registered for reflection.

Compatibility (Spring Boot)

No source changes required for existing projects (examples/ and itest/ build unchanged). Documented deltas:

  • @AliasFor removed from @ProcessEngineWorker / @Variable; topic/value and name/value alias semantics are reproduced by the core.
  • ProcessEngineStarterRegistrar.TaskHandlerWithResult / FailureRetry moved to ProcessEngineWorkerRegistrar (core).
  • registerProcessWorkers deprecated (it was never evaluated; enabled is the switch).

Documentation

README reworked (framework matrix, Quarkus sample, links), docs/process-engine-worker.md framework-neutral with corrected configuration, new docs/spring-boot.md and docs/quarkus.md, updated docs/idempotency.md and docs/process-deployment.md.

Companion step: add docs/spring-boot.md and docs/quarkus.md to the nav of process-engine-api-docs.

Out of scope / follow-ups

  • Quarkus example app and a real-engine Quarkus integration test: after process-engine-adapter-camunda-platform-c8-quarkus is released.
  • Quarkus auto-deployment of BPMN/DMN resources.
  • Reactive worker return types.

Test plan

  • ./mvnw clean verify -T4 (CI command): all modules green, 167 tests (core 67, Spring 11, JPA 16, Quarkus runtime 14, Quarkus deployment 42, Spring itests 17 against Camunda 7 + Postgres via Testcontainers)
  • -Prelease packaging: sources + javadoc jars for all new modules, extension descriptor validation passes
  • Failsafe now also runs the nested IdempotencyITest variants (previously never executed); registrar itests wait up to 60s to tolerate the external task client backoff under parallel load
  • Manual smoke test against the (unreleased) C8 Quarkus adapter once it is available

🤖 Generated with Claude Code

Extract a framework-independent core, keep the Spring Boot starter backward
compatible and add a Quarkus extension with build-time worker discovery.

Modules:
- process-engine-worker-core: annotations (without Spring @aliasfor, alias
  semantics preserved), ProcessEngineWorkerRegistrar, parameter/result
  resolution, exception handling, metrics and idempotency logic plus the SPIs
  TransactionalExecutor, AfterCommitHook and TransactionalMethodDetector.
- process-engine-worker-spring-boot-starter: thin Spring layer over the core
  (same class names, constructor, auto-configuration imports and properties).
- process-engine-worker-idempotency-registry-jpa: framework-free JPA registry
  (entity and converter moved with unchanged FQCNs and schema, EntityManager
  based registry, pluggable Java/Jackson result serialization), used by the
  Spring JPA module and the Quarkus extension.
- process-engine-worker-quarkus(-deployment): Quarkus extension (runtime in
  Kotlin, deployment in Java) with Jandex discovery of @ProcessEngineWorker
  methods, auto @singleton worker beans, registration at runtime init before
  StartupEvent, build-time validation, JTA transactions (narayana), Micrometer
  metrics and JPA idempotency as optional integrations, native image
  reflection registration and @DefaultBean producers for customization.

Documentation: README with framework matrix, framework-neutral reference,
new Spring Boot and Quarkus pages, updated idempotency and deployment pages.

Tests: core unit tests, Spring proxy/transaction tests, Hibernate/H2 tests of
the JPA module, Quarkus extension tests (QuarkusExtensionTest) and the existing
Spring integration tests (failsafe now also runs the nested IdempotencyITest
variants; waits widened to tolerate the external task client backoff).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Quarkus Support for the Process Engine Worker

1 participant