Deliver events by declared topic. Record whether a subscriber received or dropped an event, and make subscriber selection attributable to the topic and compatibility rules.Publish-subscribe
Decouple producers from consumers.
topic_based_event_deliveryRECORD STATUSCandidate · v0.1.0UML class view
The proposed contract drawn as participant roles, received calls, and numbered dependencies.
Object interactions
The same roles and calls as a class collaboration and a numbered message sequence.
Pointcut
Where the mechanism applies. All four dimensions belong to the proposed match, not just its vocabulary.
- Context
- Producers and consumers are decoupled through topics.
- Trigger
- A message is published to a topic.
- Structure
- Topic schema, broker or bus, subscribers, and delivery policy.
- Effect
- Matching subscribers receive the message under declared ordering and durability rules.
Protected contract
The obligation that clients, operators, and auditors should be able to rely on.
- Requires
- Topic identity and event compatibility are defined.
- Ensures
- Delivery or drop is observable and subscriber selection is attributable.
- Invariant
- A subscriber cannot read a topic outside its authorization.
- Violation
- Duplicate, late, or lost delivery follows an explicit semantic contract.
Negative control
Directly invoking known listeners is C02 rather than C03.
Variation & lifecycle
The hot spot is admitted only where the protected semantics survive.
Permitted variation
In-process bus, OS socket pubsub, cloud queue, and durable stream.
Test obligation
Test multi-subscriber delivery, no subscriber, disconnect, duplicate, and auth.
Evolution question
Did pubsub gain durability, replay, and authorization?
Prompt + code design
An illustrative prompt and a small design sketch for the proposed contract. Names and APIs are invented; this is not a repository excerpt.
def publish(event, bus):
subscribers = bus.subscribers(event.topic)
delivered = []
for subscriber in subscribers:
if not subscriber.accepts(event.schema):
delivered.append(Dropped(subscriber.id, "schema mismatch"))
continue
subscriber.deliver(event)
delivered.append(Delivered(subscriber.id))
bus.record(event.id, event.topic, delivered)Illustrative design sketch. Publish-subscribe needs a delivery record; broadcast is not the same as delivery. This example is a teaching aid, not implementation evidence or a conformance claim.
Detection & matching
The frozen rule that retrieves this record, the canonical source exemplar, and the control that should stay unmatched.
- Join point
topic_based_event_delivery- Source locator
- See the source record.
- Lexical cue
(?i)\b(?:pub(?:lish)?[_-]?sub(?:scribe)?|topic[_-]?bus|event[_-]?bus|subscriber)\bFrozen expression, v0.1.0. A match is a retrieval cue, not a confirmed implementation.- Aliases
- None
- Canonical exemplar
- mastra-ai/mastra
packages/core/src/events/pubsub.ts:19Support: packages/core/src/events/subscribe-start-position.test.ts:25 - Negative control
- Directly invoking known listeners is C02 rather than C03.
Scope-anchored review. pohe-agent analyze <repo> --pattern C03 anchors the cue to its enclosing declaration and checks a separate operational signature for all four pointcut dimensions. Missing roles and negative-control risks remain visible; a structural match is not E2/E3. Calibration report ↗
Repository files
Up to five public files retrieved by the frozen cue and pinned to the audited commit. A match is a place to inspect, not a confirmed implementation.
packages/core/src/events/pubsub.ts:19CANONICAL SOURCE02aaif-goose/goosecrates/goose/src/acp/provider.rs:3687RETRIEVAL CUE03agno-agi/agnolibs/agno/agno/os/event_streams/in_memory.py:24RETRIEVAL CUE04anomalyco/opencodepackages/core/src/config/plugin/skill.ts:8RETRIEVAL CUE05bytedance/deer-flowbackend/packages/harness/deerflow/client.py:969RETRIEVAL CUEEvidence & provenance
Each layer answers a different question. Do not substitute retrieval for review.
Source-located exemplar
A concrete source anchor is available for this proposed record. It is one exemplar, not evidence that all repositories—or every contract field—conform.
Review boundary: this candidate and its specification come from an AI-assisted study. Independent human validation remains open.
66.7% of repository families in the frozen panel have at least one current cue, historical cue, or canonical source layer. This is not confirmed prevalence.
Current lexical-cue repositories: 25 / 41899383db98e0packages/core/src/events/pubsub.ts:19packages/core/src/events/subscribe-start-position.test.ts:25Topic-based publish/subscribe abstraction.
Exploratory retrieval cue Regex / v0.1.0
(?i)\b(?:pub(?:lish)?[_-]?sub(?:scribe)?|topic[_-]?bus|event[_-]?bus|subscriber)\bThis expression is a discovery instrument only. A match is a retrieval cue—not a confirmed implementation, pointcut match, or contract proof.