Skip to content

API Events

Pricing's only async surface is one inbound Debezium CDC topic. It has no outbound domain events, no BullMQ, and no WebSocket. The Kafka producer is bound by ApplicationKafkaComponent but no domain logic publishes to it today.

1. Inbound — Kafka

TopicProducerHandlerIdempotency KeyFailure Mode
CDCKafkaTopics.PRODUCT_VARIANTDebezium (commerce DB CDC)PricingWorkerService.handleProductVariantCDC(productVariantId) — skips if FareSet exists; FBT skips per (relatedFareSetId, leadVariantId)autocommit: false — offset committed only after handler succeeds; throw blocks commit and re-delivers

Consumer config (src/components/kafka/component.ts): groupId PRICING_CONSUMER_GROUP (env-overridable), fallbackMode: 'latest', manual commit after each message.

Handled operations: only DebeziumPayloadOperators.CREATE and RETRIEVE. UPDATE / DELETE are no-ops. Deleted (deletedAt set) payloads are skipped.

2. Outbound — Kafka

None. The producer helper is bound (BindingKeys.APPLICATION_KAFKA_PRODUCER, idempotent + lz4 + acks=ALL) but no service emits. Reserved for future price-change events.

3. Inbound — BullMQ

None. Pricing mounts no QueueComponent / BullMQ.

4. Outbound — BullMQ

None.

5. WebSocket Emissions

None. Pricing mounts no WebSocket component.

6. Payload Schemas

The inbound message is a Debezium envelope over a ProductVariant row. Pricing only reads metadata:

ts
// TDebeziumMessage<TProductVariantPgRow> — relevant slice
interface ProductVariantMetadata {
  pricing?: {
    sellingPrice?: string; // seeds default SALE fare amount
  };
  referenceId?: string;    // deep-copy this variant's FareSet structure
  bundlers?: Array<{
    type: string;                    // ProductBundlerTypes.FBT triggers override seeding
    relatedProductVariantId: string; // FareSet to receive the override child
    basis?: string;                  // ProductBundlerBasises.FIXED | PER_UNIT (others skipped)
    basisValue?: string;
    quantity?: string;
  }>;
}

Source of truth for the payload type is @nx/core (TProductVariantPgRow, TProductVariantMetadata) — pricing does not define its own message schema.

7. Idempotency & Ordering

TopicDeliveryOrderingRecovery
PRODUCT_VARIANTat-least-once (manual commit)per-partition (Debezium keys by PK)Handler is idempotent — replay/redelivery re-checks existing FareSet/FBT override and skips

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