Turn a message topic into a clear contract
Event-driven systems break quietly: a producer renames a field, a consumer assumes at-least-once delivery, a poison message loops forever. The fix is a written contract for every topic. This builder generates a complete, broker-agnostic Markdown spec — payload schema, producers, consumers, retry policy, and dead-letter rules — so both sides of the queue agree before they ship.
How it works
You describe the topic and the builder assembles a structured Markdown document with these sections:
- Topic — the name and a one-line purpose, plus delivery semantics (at-least-once, at-most-once, or exactly-once).
- Payload schema — your fields rendered as a typed JSON example and a field table, so consumers know exactly what to parse.
- Producers — the services that publish to the topic, making ownership explicit.
- Consumers — the services that subscribe, each effectively a separate contract.
- Retry policy — strategy (exponential backoff), max attempts, and base delay.
- Dead-letter queue — the target queue name and the condition that routes a message there.
The payload table infers a JSON type from each field’s declared type, and the example object shows a representative value per field so the document doubles as a quick reference.
Tips and notes
- Name topics for the event that happened, in the past tense (
orders.created,payment.failed). Consumers subscribe to facts, not commands. - State delivery semantics explicitly. Most brokers give at-least-once, which means consumers must be idempotent — process the same message twice without side effects.
- Size the dead-letter queue’s alerting, not just its existence: a message landing there is an incident signal, not a place data goes to be forgotten.
- Version the payload (
schemaVersionfield or a topic suffix) so you can evolve the schema without breaking older consumers.