Topic
A named channel that a message broker groups messages under, connecting publishers to subscribers that don't know about each other.
A topic is a named channel that a Message Broker groups messages under. Publishers write to a topic by name, and subscribers pick the same name to read from it. Neither side knows the other exists.
That name is the entire coupling between them. The publisher's job ends when the Message lands on the topic. It doesn't know if one service reads it, ten do, or none at all. You can add a new subscriber next month without touching the publisher's code, and each subscriber (or consumer group) receives its own copy of every message and processes it at its own pace.
messaging infrastructure
References
- Live website updates with Go, SSE, and htmx: Explains that every Pub/Sub interaction involves a topic: a string that decides who gets the message. Shows a GeneratePublishTopic function that derives the topic name from the event name by convention.
- Distributed Transactions in Go: Read Before You Try: Defines a topic as what you subscribe to to receive messages, and configures an event bus that uses the event's name as the topic. Stresses that the forwarder topic must match between the forwarder publisher and the forwarder itself.
- Using MySQL as a Pub/Sub: Defines any Pub/Sub client with two methods: publishing a message to a topic and subscribing for messages from a topic. Shows a handler that moves messages between a Google Cloud topic and a MySQL table acting as the publisher's topic.
- Watermill 1.3 released, an open-source event-driven Go library: Discusses the common setup of one event type per topic versus keeping all events on one topic with a handlers group. Also covers renaming outbox topics when migrating the messages table.
- Watermill 1.4 Released (Event-Driven Go Library): Shows how a broken message can block an entire topic, and how the poison queue middleware moves failed messages to a separate topic so the Requeuer can later move them back to the original one.
- Golang CQRS, Metrics and AMQP - Watermill v0.3.0 released: Notes glossary incompatibilities between Watermill and AMQP: topic has a different meaning there, which the documentation explains.
- Introducing Watermill - Go event-driven applications library: Presents Watermill's core Publisher and Subscriber interfaces, where both publishing and subscribing are addressed by a topic name.
- Event-Driven Architecture: The Hard Parts: Recommends component tests that use the production topology, including setups like a single event topic that routes events to a data lake or event log.
- Watermill: from a hobby project to 8k stars on GitHub: Describes Watermill's high-level API goal: adding support for one event without thinking about topics, Kafka, or whatever message broker runs under the hood. Every Pub/Sub implements one interface for publishing to and subscribing from a topic.
- Synchronous vs Asynchronous Architecture: Discusses monitoring asynchronous systems: what queue length or oldest message age means depends on the queue, topic, or subscription, so alerting needs more design than watching a load balancer.