Processing Chain
The library uses a Chain of Responsibility pattern to process outbox records through multiple stages. Each processor in the chain handles a specific concern and can delegate to the next processor when needed.
Chain Architecture
The processing chain consists of four processors, executed in this exact order:
Processing Flow:
-
Primary Handler Processor - Invokes the registered handler for the payload type. On success, marks record as
COMPLETED. On exception, passes to Retry Processor. -
Retry Processor - Evaluates if the exception is retryable and if retry limit is not exceeded. Schedules next retry with calculated delay or passes to Fallback Processor.
-
Fallback Processor - Invokes registered fallback handler if available. On success, marks record as
COMPLETED. On failure or if no fallback exists, passes to Permanent Failure Processor. -
Permanent Failure Processor - Marks the record as permanently
FAILED. Final state - no further processing.
Processing Flow Examples
Scenario 1: Retries Exhausted with Successful Fallback
Order processing with 3 max retries and fallback handler:
Scenario 2: Non-Retryable Exception
Order processing with non-retryable exception:
Scenario 3: No Fallback Handler
Order processing without fallback handler:
Processing Configuration Options
The following options control how records are processed:
| Property | Default | Description |
|---|---|---|
namastack.outbox.processing.stop-on-first-failure | true | Stop processing on first failure |
namastack.outbox.processing.delete-completed-records | false | Delete records after completion |
namastack.outbox.processing.executor-core-pool-size | 4 | Core threads for processing (platform threads) |
namastack.outbox.processing.executor-max-pool-size | 8 | Maximum threads for processing (platform threads) |
namastack.outbox.processing.executor-concurrency-limit | -1 | Concurrency limit for virtual threads (-1 unlimited) |
namastack.outbox.processing.shutdown-timeout-seconds | 30 | (deprecated) Use shutdown-timeout |
namastack.outbox.processing.shutdown-timeout | 30s | Maximum time to wait for processing to complete during shutdown |
shutdown-timeout-secondsis deprecated and will be removed in a future release. Useshutdown-timeoutinstead.- Both options control the maximum time the system will wait for in-flight processing to complete during a graceful shutdown.