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
ApplicationKafkaComponentbut no domain logic publishes to it today.
1. Inbound — Kafka
| Topic | Producer | Handler | Idempotency Key | Failure Mode |
|---|---|---|---|---|
CDCKafkaTopics.PRODUCT_VARIANT | Debezium (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:
// 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
| Topic | Delivery | Ordering | Recovery |
|---|---|---|---|
PRODUCT_VARIANT | at-least-once (manual commit) | per-partition (Debezium keys by PK) | Handler is idempotent — replay/redelivery re-checks existing FareSet/FBT override and skips |