Skip to content

API Events

The only async surface is one CDC consumer. There are no Kafka producers, BullMQ queues, or WebSocket emissions.

1. Inbound — Kafka

TopicProducerHandlerIdempotency KeyFailure Mode
public.Product (CDCKafkaTopics.PRODUCT)Debezium (commerce)TaxationWorkerService.handleProductCDC(productId, taxGroupId, op) — provision is idempotentlog + skip (autocommit; no DLQ)

Consumer config (ApplicationKafkaComponent):

SettingValue
Client IDAPP_ENV_KAFKA_CLIENT_ID (default SVC-00130-TAXATION_CONSUMER)
Group IDAPP_ENV_KAFKA_GROUP_ID (default SVC-00130-TAXATION_CONSUMER_GROUP)
Key deserializerstringDeserializer
Value deserializerjsonDeserializer
fallbackModelatest (no historical backfill)
autocommittrue
requestTimeout / connectTimeout / maxWaitTime60000 / 30000 / 5000 ms

Op routing:

Debezium opAction
c, u, r_reconcileTaxProvisions(after)
ddeprovisionForProduct(before.id ?? after.id)
otherignored

Reconcile branch (c/u/r):

Product stateAction
deletedAt setdeprovision
no taxGroupIddeprovision
taxGroupId presentprovision (idempotent)

2. Outbound — Kafka

None. Taxation does not produce events. Provisioned TaxSet/Tax rows are read by pricing directly from the shared DB.

3. Inbound — BullMQ

None.

4. Outbound — BullMQ

None.

5. WebSocket Emissions

None.

6. Payload Schemas

Inbound payload is a Debezium envelope around a Product row. Types are from @nx/core (TDebeziumMessage, TDebeziumPayload, TProductPgRow). Snake_case row keys are converted via toCamelCaseKeys before use.

ts
// CDCKafkaTopics.PRODUCT — message.value
interface TDebeziumMessage<TProductPgRow> {
  payload: TDebeziumPayload<TProductPgRow>;
}

interface TDebeziumPayload<T> {
  op: 'c' | 'u' | 'r' | 'd';
  before: T | null; // snake_case
  after: T | null;  // snake_case
}

// Fields read by the worker (post toCamelCaseKeys):
//   id: string
//   taxGroupId: string | null
//   deletedAt: string | null

7. Idempotency & Ordering

TopicDeliveryOrderingRecovery
public.Productat-least-once (autocommit)per-partition (per product key)re-deliver replays reconcile; provision skips when already provisioned with the same TaxGroup

No DLQ: onMessageError logs only. fallbackMode: latest means rows changed while the consumer was down before the offset window are not reprocessed — there is no backfill job (ADR-0001).

Proprietary and Confidential. Unauthorized copying, distribution, or use of this software is strictly prohibited.