agentleFS
mejbaurbaharmejbaurbahar/software-tester-skills/skills/event-driven-messaging-testing/SKILL.md

event-driven-messaging-testing

Skill1 starsChanged 53 days agoMITView on GitHub

Use when testing message queues and event streams — Kafka, RabbitMQ, SQS/SNS, Pub/Sub, NATS, webhooks — covering schema evolution, ordering, at-least-once delivery, idempotent consumers, dead-letter queues, replay, and eventual consistency.

  • Sends data out

The file

Files
SKILL.md

Event-Driven & Messaging Testing

Async systems fail quietly: messages get lost, duplicated, reordered or poisoned, and the effect shows up minutes later somewhere else.

Properties to test

PropertyTest
Delivery semanticsKill consumer mid-processing → message redelivered (at-least-once); no loss
IdempotencyDeliver same message 2–5× → same end state (dedupe key / upsert)
OrderingPer-partition/key order preserved; consumer tolerant when cross-key order isn't guaranteed
Schema evolutionOld consumer + new producer and vice versa (Avro/Protobuf/JSON Schema compat: BACKWARD/FORWARD/FULL)
Poison messageMalformed message → retry N → DLQ, main flow continues; alert fires
Retry/backoffTransient failure retried with backoff; permanent failure not retried forever
BackpressureSlow consumer → lag metric grows, producers throttled, no OOM
ReplayReprocessing a topic from offset 0 yields same result; side effects guarded
Transactional outboxDB write + event publish atomic (no dual-write gap)
Eventual consistencyRead-your-writes UX; poll-until with timeout, never sleep

Tooling

docker compose up -d kafka schema-registry            # or Testcontainers
kcat -b localhost:9092 -t orders -P <<< '{"id":1}'     # produce
kcat -b localhost:9092 -t orders -C -o beginning -e    # consume
kafka-consumer-groups --bootstrap-server :9092 --describe --group billing   # lag
rabbitmqadmin list queues name messages_ready messages_unacknowledged
awslocal sqs receive-message --queue-url $Q --max-number-of-messages 10     # LocalStack
// Testcontainers Kafka in JUnit 5
@Container static KafkaContainer k = new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:7.6.0"));
# wait for effect — never sleep
from tenacity import retry, stop_after_delay, wait_fixed
@retry(stop=stop_after_delay(10), wait=wait_fixed(0.2))
def order_is_shipped(): assert db.get(order_id).status == "SHIPPED"

Contract & schema

Register schemas; CI check curl -X POST .../compatibility/subjects/orders-value/versions/latest; consumer-driven contracts for messages (Pact message pacts, contract-testing); never remove/rename fields, only add optional ones.

Webhooks

Signature verification (HMAC), replay window/timestamps, retries with 5xx, out-of-order & duplicate delivery, 2xx-fast + async processing, endpoint idempotency, delivery logs.

Failure injection

Broker restart · partition rebalance during processing · network partition (toxiproxy) · consumer crash after side-effect before ack · duplicate producers · clock skew — see chaos-resilience-testing.

Related

microservices-testing, contract-testing, integration-testing, observability-testing, concurrency-race-condition-testing

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.