intermediate

Topic

Используйте topics для named event streams или publish-subscribe channels, где несколько independent consumers получают related messages.

Topics именуют stream или channel, куда publishers emit messages, а multiple subscribers получают копии — pub/sub semantics. В Kafka topic — durable partitioned log; в RabbitMQ topic exchanges route по routing keys.

Компромисс: гибкость fan-out против consumer coordination и retention management.

На интервью: OrderPlaced как topic с inventory, billing и analytics subscribers; выбор partition key.

Типовые ошибки: один topic для несвязанных events; subscribers без consumer groups конкурируют неверно; нет retention policy.

Чеклист:

  • Имена topics по domain event или bounded context.
  • Документируйте producers, schemas и subscribers.
  • Partitioning под scale и ordering needs.
  • Retention под replay requirements.