Exercise 1: Adding a Fourth Subscriber, InventoryService — Possible Solution ==================================================================== THE NEW SUBSCRIBER ------------------------------ class InventoryService: def __init__(self): self.reservations = [] def reserve_stock(self, event): self.reservations.append(f"Reserving stock for order {event['order_id']}") Follows this chapter's own subscriber shape exactly - a single method taking the event payload, matching UserService.award_loyalty_points and EmailService.send_confirmation's own signature. WIRING IT UP ------------------------------ bus.subscribe('OrderPlaced', inventory_service.reserve_stock) One line, added alongside the three existing subscriptions - no changes anywhere else. VERIFYING ALL FOUR SUBSCRIBERS FIRE CORRECTLY FROM ONE place_order() CALL ------------------------------ user_service.users: {'USER-1': {'points': 10}} email_service.sent_emails: ['Emailing user USER-1: order total 100'] analytics_service.logged_events: [{'order_id': 'ORD-1', 'items_total': 100, 'user_id': 'USER-1'}] inventory_service.reservations: ['Reserving stock for order ORD-1'] All four subscribers - the two from this chapter's original example, plus AnalyticsService (already established) and the new InventoryService - correctly reacted to the single order_service.place_order('ORD-1', 100, 'USER-1') call. VERIFYING OrderService STILL HAS ZERO KNOWLEDGE OF THE NEW SUBSCRIBER ------------------------------ OrderService source references InventoryService: False Confirmed via inspect.getsource(), exactly matching this chapter's own verification method for UserService and EmailService. WHY THIS CONFIRMS THE PATTERN SCALES ------------------------------ This chapter's own text already showed a third subscriber (Analytics) requiring zero OrderService changes. This exercise confirms a FOURTH subscriber requires the same zero changes - the event bus's own decoupling doesn't degrade as more listeners are added; OrderService's own responsibility stays exactly "publish what happened," regardless of how many things end up listening for it. WHY THIS WORKS AS AN ANSWER ------------------------------ The new subscriber follows this chapter's own established interface exactly, all four subscribers' correct behavior from one publish call is verified directly, and OrderService's own continued ignorance of the new subscriber is confirmed via the same source-inspection technique this chapter already used, not just assumed to still hold.