Opinionated preferences for reliable RabbitMQ messaging: quorum queues, publisher confirms, manual acks, dead lettering, retries and idempotent consumers.
# RabbitMQ Messaging taste of an engineer who wants every message accounted for - Declare exchanges, queues and bindings in code or a definitions file at startup, never by hand in the management UI. Confidence: 0.90 - Use quorum queues for anything that matters; keep classic queues only for throwaway, non-critical traffic. Confidence: 0.90 - Make queues durable and publish messages as persistent, and enable publisher confirms on every producer. Confidence: 0.95 - Publish to a named topic exchange, never to the default exchange with a queue name as routing key. Confidence: 0.80 - Use routing keys shaped like domain.entity.event (orders.order.created) so consumers bind with wildcards. Confidence: 0.80 - Give each consuming service its own queue bound to the exchange; services never share a queue. Confidence: 0.90 - Turn off auto-ack and ack only after the work and its side effects are committed. Confidence: 0.95 - Set a prefetch (basic.qos) per consumer, starting around 10 to 50, instead of leaving it unlimited. Confidence: 0.85 - Make every consumer idempotent with a message_id and a processed-ids table, because delivery is at least once. Confidence: 0.95 - Configure a dead letter exchange for every work queue and alert when the dead letter queue is not empty. Confidence: 0.90 - Retry with delay through a TTL retry queue or the delivery-limit setting, with a capped number of attempts, never a hot requeue loop. Confidence: 0.85 - Reject poison messages without requeue after the retry limit so one bad payload cannot block the queue. Confidence: 0.85 - Send JSON with a content_type, a schema version field and a stable message type header. Confidence: 0.80 - Keep messages small (under about 128 KB) and put large payloads in object storage with a link in the message. Confidence: 0.80 - Propagate trace context (traceparent) in message headers so traces cross the broker. Confidence: 0.80 - Use the transactional outbox pattern to publish events that must match a database write. Confidence: 0.85 - Open one long-lived connection per process and separate channels for publishing and consuming. Confidence: 0.80 - Set queue length limits or message TTLs on queues that can grow without bound. Confidence: 0.75 - Do not use RabbitMQ as a long-term event log; reach for streams or Kafka when replay is a requirement. Confidence: 0.75 - Monitor queue depth, consumer count, unacked messages and publish and deliver rates with the Prometheus plugin. Confidence: 0.85 - Run a three-node cluster for production and use a separate vhost and user per application with least privilege. Confidence: 0.80 - Test consumers against a real broker in CI with Testcontainers instead of mocking the client library. Confidence: 0.75
Opinionated conventions for reliable, schema-governed Kafka event streaming and consumers.
# Kafka Streaming taste of a pragmatic event platform engineer - Name topics by domain and event, such as `orders.order-placed.v1`, and put the schema version in the name only when a breaking change forces a new topic. Confidence: 0.85 - Register every topic schema in a schema registry (Avro or Protobuf) with backward compatibility enforced; never publish raw untyped JSON to shared topics. Confidence: 0.90 - Choose the partition key from the entity whose ordering matters (order id, account id), and never rely on ordering across partitions. Confidence: 0.95 - Start with enough partitions for expected peak consumer parallelism plus headroom, because increasing partitions later breaks key-to-partition mapping. Confidence: 0.80 - Run producers with `acks=all`, idempotence enabled and `min.insync.replicas=2` on a replication factor of 3 for anything business-critical. Confidence: 0.90 - Treat delivery as at-least-once and make every consumer idempotent with a dedupe key or upsert, instead of chasing end-to-end exactly-once. Confidence: 0.90 - Commit offsets only after the side effect has succeeded; disable auto-commit for consumers that write to databases or call APIs. Confidence: 0.90 - Send messages that fail repeatedly to a dead-letter topic with the original headers, error and attempt count, and alert on its growth. Confidence: 0.85 - Retry transient failures with bounded backoff inside the consumer before dead-lettering; never block a partition forever on one poison message. Confidence: 0.85 - Keep events as facts in past tense that describe what happened, not commands telling another service what to do. Confidence: 0.80 - Keep payloads small and self-contained enough to process without a synchronous call back to the producer, but put large blobs in object storage and send a reference. Confidence: 0.75 - Use the transactional outbox pattern to publish events atomically with database writes instead of dual writes. Confidence: 0.90 - Use log compaction for topics that represent the latest state per key, and time-based retention for pure event streams. Confidence: 0.85 - Monitor consumer lag per group and partition as the primary health signal, alerting on sustained growth rather than single spikes. Confidence: 0.90 - Put a correlation id and the producing service name in message headers so traces can follow an event across services. Confidence: 0.80 - Give every consumer group a stable, descriptive id tied to the service, and never share one group between unrelated applications. Confidence: 0.85 - Reach for Kafka Streams or Flink only when you need stateful joins or windowing; a plain consumer is simpler for stateless transforms. Confidence: 0.75 - Manage topics, partitions, retention and ACLs as code reviewed in pull requests, and disable automatic topic creation in production. Confidence: 0.90 - Lock down clusters with TLS, authenticated clients and per-service ACLs that grant only the topics each service needs. Confidence: 0.85 - Test consumers against a real broker in containers for integration tests, and keep unit tests on pure handler functions. Confidence: 0.80 - Document each topic's owner, schema, key, retention and consumers in a catalog that lives next to the topic definitions. Confidence: 0.70
Opinionated conventions for designing reliable event-driven and message-based systems.
# Event-Driven Architecture taste of a distributed systems engineer - Use events to announce facts that already happened (OrderPlaced), and commands only for requests to a single owner (ChargeCard). Confidence: 0.90 - Name events in the past tense using domain language, never after the producing table or service. Confidence: 0.85 - Define every event with a versioned schema (Avro, Protobuf or JSON Schema) in a registry and check compatibility in CI. Confidence: 0.90 - Evolve schemas only with backward-compatible changes; publish a new event type for breaking changes. Confidence: 0.85 - Assume at-least-once delivery and make every consumer idempotent with a deduplication key. Confidence: 0.95 - Publish events through the transactional outbox pattern so database writes and messages never diverge. Confidence: 0.90 - Include event id, type, version, timestamp, correlation id and causation id in every envelope. Confidence: 0.85 - Keep event payloads self-contained enough for common consumers, but do not dump whole aggregates. Confidence: 0.75 - Partition by aggregate id when ordering matters, and never rely on global ordering. Confidence: 0.85 - Route poison messages to a dead-letter queue after bounded retries with exponential backoff and jitter. Confidence: 0.90 - Alert on consumer lag and dead-letter queue depth, not just on broker health. Confidence: 0.90 - Propagate trace context through message headers so one request can be followed across services. Confidence: 0.85 - Use sagas with explicit compensating actions for multi-service workflows instead of distributed transactions. Confidence: 0.80 - Prefer choreography for simple flows and a dedicated orchestrator once a workflow has more than a few steps. Confidence: 0.70 - Reach for event sourcing only where an audit trail or temporal queries are real requirements. Confidence: 0.75 - Make replays safe: consumers must tolerate reprocessing history from any offset. Confidence: 0.80 - Set retention to match how long consumers might need to rebuild state, and document it per topic. Confidence: 0.70 - Give each topic one owning team that controls its schema and lifecycle. Confidence: 0.85 - Keep synchronous calls for queries that need an immediate answer; do not force request-response through a queue. Confidence: 0.80 - Test consumers with contract tests against the registered schema and producers with outbox integration tests. Confidence: 0.80 - Keep a living catalog (AsyncAPI or similar) of topics, producers and consumers. Confidence: 0.75