Skip to content

Cross-Package Messaging (Kafka / CDC)

Page needs a deeper rewrite

This page previously documented a packages/core/src/common/queues/ BullMQ queue subsystem (CommerceQueueDefinitions, FinanceQueueDefinitions, partitioned queue names, etc.). That subsystem no longer exists. Core's cross-package seam is now Kafka (domain events) and Debezium CDC. The content below is a corrected stub; the full topic-by-topic reference is still to be written. Source of truth: packages/core/AGENTS.md and src/common/kafka/.

Where Messaging Lives

ConcernSourceExports
Domain event topicssrc/common/kafka/topics.tsKafkaTopics
CDC topicssrc/common/kafka/topics.tsCDCKafkaTopics
Message typessrc/common/kafka/types.tsShared Kafka message types
CDC table constantssrc/common/cdc/tables.tsCdcTables
Event definitionssrc/common/events/commerce-events.ts, ledger-events.ts, payment-events.ts, websocket-events.ts
Event bussrc/helpers/event-bus/IEventBus + Redis Pub/Sub adapter

KafkaTopics

Domain-event topic-name constants plus a build({ paths }) helper that prefixes topic names with nx.seller. Examples of domain events: PAYMENT_SUCCESS, INVENTORY_ISSUED_FOR_SALE, LEDGER_GENERATE, MATERIAL_STOCK_CHANGED.

typescript
import { KafkaTopics } from '@nx/core';

const topic = KafkaTopics.build({ paths: [KafkaTopics.PAYMENT_SUCCESS] });
// => prefixed with "nx.seller"

CDCKafkaTopics

Debezium change-data-capture topic names, built from CdcTables (e.g. MERCHANT, PRODUCT, SALE_ORDER). Services subscribe to CDC topics to react to row-level changes in another domain's tables.

Event Bus

For in-process pub/sub (not Kafka), @nx/core exposes the IEventBus interface with a Redis Pub/Sub adapter. See Event Bus.

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