---
id: ADR-COM-CAT-013
title: Direct Asynchronous Code Issuance
product_area: commerce
module: catalog
revision: 1
status: proposed
design_intent: proposed
source_sha:
  services-commerce: c8b66a98e2490617aec38ba5c8165dd9bd0a8f9b
  react-console: baf6dae382d6f41dce976c7f848667ccc37e076f
decision: >-
  Saved code batches invoke the module’s worker asynchronously and resume from stored progress without a
  separate queue or data-job dispatcher.
constrains:
  - SVC-COM-CAT-promotions
  - WF-COM-CAT-013
  - STATE-COM-CAT-009
origin: COMM-M1b D-R2 (the code generation job with CSV)
alternatives:
  - option: Dispatch code generation through import data jobs
    why_not: The implemented data-job mechanism organizes imported records rather than a bounded code generator.
  - option: Always create the whole batch inside the interactive request
    why_not: The deployed path uses background execution; inline execution is retained when no worker is configured.
consequences:
  - 'Recovery can use failed Lambda execution, repeated requests or stale progress reads.'
  - 'Without a supplied request key, a repeated request can create another batch.'
supersedes: []
evidence:
  - >-
    services-commerce at c8b66a98: modules/promotions/services/issuance/issuance-starter.ts, issuance-job.ts;
    aws/logic/promotion-code-issuance-worker.lambda.ts.
---

# Direct Asynchronous Code Issuance

## Context

A request can generate up to five thousand codes. Work must retain progress and avoid exceeding the requested count across restarts.

## Decision

Saved code batches invoke the module’s worker asynchronously and resume from stored progress without a separate queue or data-job dispatcher.

## Alternatives Considered

Dispatch code generation through import data jobs. The implemented data-job mechanism organizes imported records rather than a bounded code generator.

Always create the whole batch inside the interactive request. The deployed path uses background execution; inline execution is retained when no worker is configured.

## Consequences

Recovery can use failed Lambda execution, repeated requests or stale progress reads. Without a supplied request key, a repeated request can create another batch.
