Skip to main content
Version: 1.7.x

Processing Chain

Internal Processing Pipeline

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:

  1. Primary Handler Processor - Invokes the registered handler for the payload type. On success, marks record as COMPLETED. On exception, passes to Retry Processor.

  2. 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. When the scheduled retry becomes due, the scheduler sends the record through the Primary Handler Processor again; OutboxRecordMetadata.failureCount reflects the previous failed attempts.

  3. 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.

  4. 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:

PropertyDefaultDescription
namastack.outbox.processing.stop-on-first-failuretrueStop processing on first failure
namastack.outbox.processing.delete-completed-recordsfalseDelete records after completion
namastack.outbox.processing.executor-core-pool-size4Core threads for processing (platform threads)
namastack.outbox.processing.executor-max-pool-size8Maximum threads for processing (platform threads)
namastack.outbox.processing.executor-concurrency-limit-1Concurrency limit for virtual threads (-1 unlimited)
namastack.outbox.processing.shutdown-timeout-seconds30(deprecated) Use shutdown-timeout
namastack.outbox.processing.shutdown-timeout30sMaximum time to wait for processing to complete during shutdown
  • shutdown-timeout-seconds is deprecated and will be removed in a future release. Use shutdown-timeout instead.
  • Both options control the maximum time the system will wait for in-flight processing to complete during a graceful shutdown.