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
| Concern | Source | Exports |
|---|---|---|
| Domain event topics | src/common/kafka/topics.ts | KafkaTopics |
| CDC topics | src/common/kafka/topics.ts | CDCKafkaTopics |
| Message types | src/common/kafka/types.ts | Shared Kafka message types |
| CDC table constants | src/common/cdc/tables.ts | CdcTables |
| Event definitions | src/common/events/ | commerce-events.ts, ledger-events.ts, payment-events.ts, websocket-events.ts |
| Event bus | src/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.
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.