Skip to content

EIP wave 6: process manager - #11

Merged
brunosouzas merged 7 commits into
mainfrom
ab110-eip-wave-6-process-manager
Nov 26, 2026
Merged

brunosouzas merged 7 commits into
mainfrom
ab110-eip-wave-6-process-manager

Conversation

@brunosouzas

Copy link
Copy Markdown
Owner

Adds the Process Manager pattern (wave 6) under src/main/mule/eip/process-manager/ with its MUnit suite.

  • POST /eip/process-manager/orders starts a process (202, processId); simulated payment, stock, invoice and refund services answer 202 and reply asynchronously to POST /eip/process-manager/replies, correlated by processId.
  • Process state (status, currentStep, history) in a persistent Object Store; the manager decides the next step from each reply: payment declined -> FAILED, stock unavailable -> refund (compensation) -> CANCELLED, all ok -> COMPLETED. GET /eip/process-manager/processes/{processId} reads it.
  • Replies applied once per process and step (os:store failIfPresent on a receipts store): repeat 200 DUPLICATE, unexpected step 409, ended process 409, unknown process 404, unknown outcome 400; a command that cannot be sent suspends the process (503).
  • Comments say when a Process Manager is overkill and cite docs.mulesoft.com per component. No broker, no external systems, existing endpoints unchanged.
  • README, AGENTS.md, requests.http updated.

mvn clean test: 190 tests, 0 failures, 0 errors, application coverage 98.53%.

AB#110

…istent store and decides the next step from each asynchronous reply, with refund compensation and idempotent replies
…led with refund, duplicate, unknown and late replies, suspended command; polls instead of sleeping
@brunosouzas

Copy link
Copy Markdown
Owner Author

Applied all binding review decisions in 0f6772b and 1e9c087 (no merge).

Finding → change:

  1. Lost update on SUSPENDED → re-read state; suspend only if currentStep and history equal the sent state, otherwise keep the newer state. HTTP start/GET regression injects an already-applied reply before error handling. Comment explicitly limits this non-atomic read/write to one worker; no lock beyond receipt claim.
  2. Concurrent copies → Scatter-Gather sends two real HTTP POSTs to /replies. A test-only pre-claim barrier ensures both read state before claiming, exercising OS:KEY_ALREADY_EXISTS: one APPLIED, one DUPLICATE, exactly one PAYMENT:REPLY.
  3. Conflicting outcome → 409 Conflicting reply for same step/different outcome, including losing concurrent claims; HTTP regression verifies unchanged history.
  4. Applied reply / refund failure → next command failure returns 200 APPLIED with SUSPENDED to replying service; start still returns 503. REFUND:FAILED ends COMPENSATION_FAILED; HTTP tests cover both and rejection of later replies. README/comments explain manual or Scheduler recovery and no resume endpoint.
    5–6. Wording → repeated already-applied reply while running is DUPLICATE; not-accepting-replies states list includes COMPENSATION_FAILED and SUSPENDED.
  5. Retention → Object Store reference comment and production TTL/cleanup warning; receipts expire after 7 days with hourly expiration checks.
  6. Structured 503 → processId/status in response body; tests consume processId directly, no parsing error text.
  7. Reply lost → HTTP-start regression mocks callback connectivity failure, waits for loss log, GET verifies RUNNING/PAYMENT with only SENT history.
  8. Display name → Check Duplicate Or Expected Step.

Verification: full Java 17 mvn clean test under shared mvn.lock: BUILD SUCCESS; 196 tests, 0 failures/errors/skips; application coverage 98.87%; process-manager.xml 100.00%, process-manager-services.xml 100.00%. Lock removed. README count updated to 196. Tests are all in src/test/munit/eip/process-manager-test-suite.xml (15 tests); test names were listed after the final build. No independent second review performed in this executor task.

brunosouzas-agent and others added 2 commits November 26, 2026 14:52
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolves the README coverage line with #12: 198 cases at about 99.4%
(local MUnit run on this merge).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@brunosouzas
brunosouzas merged commit 6ddb14b into main Nov 26, 2026
2 checks passed
@brunosouzas
brunosouzas deleted the ab110-eip-wave-6-process-manager branch November 26, 2026 15:58
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.

2 participants