Introduction to Pub-Sub 00:00:01 One bell, three different desks A new library member enrolls. Analytics counts a signup, the mail desk prepares a welcome note, and audit keeps a record. A topic lets the enrollment service announce one event to independent subscriptions. The user service publishes a user-created event to the user events topic. Every subscription gets its own copy. Analytics pulls its copy and starts work. Analytics and email acknowledge. The audit log's copy is still waiting, and that is fine. The subscription is the unit of independent progress. An offline email desk can accumulate work while audit and analytics continue receiving theirs. 00:00:42 Send only the envelopes each desk requested Give messages explicit attributes, such as order created or completed. Each subscription can filter on the attributes supported by the broker. The publisher still describes an event using a shared contract. Inventory wants type created, billing wants everything, analytics wants type completed. It matches inventory and billing. Analytics is skipped. It matches billing and analytics. Inventory is skipped. Two events and three subscriptions could be six deliveries. Filters make it four. Watch the number of deliveries in this particular example shrink from six possible combinations to four matches. A missing or incorrectly typed attribute can silently change which desk sees an event. 00:01:26 Two clerks can share one inbox The billing team now hires a second clerk. Two workers on the same subscription divide work. Two separate subscriptions would each receive eligible events and maintain their own progress instead. The billing subscription holds messages 1 to 4. Worker 1 takes message 1 and worker 2 takes message 2. Each acknowledges and takes another: 3 and 4. Worker 1 did 1 and 3, worker 2 did 2 and 4. Nothing was done by both. In this failure-free run each message reaches one billing clerk. With redelivery the same logical event can reach another clerk later, so keep a stable event identity. 00:02:06 A clerk finishes, then drops the receipt Worker one might have written an email record just before its acknowledgment vanishes. The broker cannot infer that effect from silence. It eventually offers the outstanding message to a worker again. Worker 1 takes message 7. A 10 second deadline starts. Worker 1 stops. Nobody acknowledges. Worker 2 gets it. Worker 1 may already have done half the work. Worker 2 finishes and acknowledges. Had it failed too many times, it would have gone to the dead-letter topic. Commit the event identifier and intended effect durably together, or call a destination that honors an idempotency key. Acknowledging after that point makes a redelivery recoverable. 00:02:46 Keep one person's mail in order If the product requires per-member ordering, define the member as an ordering key and choose a service configuration that supports it. A blocked event can delay later events for that person. A1, A2 and A3 belong to user A. B1 belongs to user B. A1 and B1 can go at once. A2 waits for A1. A1 is tried again, and A2 and A3 keep waiting. B is not affected. A1 succeeds, then A2, then A3. The library now has a precise contract. Subscriptions separate independent desks, workers share a desk, and ordering keys bound the mail that has to wait together.