{
  "name": "Kafka: sipariş olayı üret ve tüket",
  "variables": { "topic": "orders" },
  "scenarios": [
    {
      "name": "uretici",
      "executor": { "type": "constant-arrival-rate", "rate": 500, "timeUnit": "1s", "duration": "5m", "preAllocatedVUs": 20, "maxVUs": 100 },
      "steps": [
        { "id": "produce", "name": "Sipariş olayı üret", "protocol": "kafka", "connection": "kafka",
          "kafka": { "action": "produce", "topic": "{{topic}}", "key": "order-{{$uuid}}",
            "value": "{\"orderId\":\"{{$uuid}}\",\"amount\":{{$randInt 10 5000}},\"ts\":{{$timestamp}}}",
            "headers": [ { "key": "source", "value": "spitfire" } ] } }
      ]
    },
    {
      "name": "tuketici",
      "executor": { "type": "constant-vus", "vus": 10, "duration": "5m" },
      "steps": [
        { "id": "consume", "name": "Olayı tüket", "protocol": "kafka", "connection": "kafka",
          "kafka": { "action": "consume", "topic": "{{topic}}", "groupId": "spitfire-loadtest", "wait": "5s" },
          "checks": [ { "type": "jsonPath", "path": "$.orderId", "op": "exists" } ] }
      ]
    }
  ],
  "thresholds": [
    { "metric": "req_duration", "filter": { "step": "produce" }, "expr": "p(95)<50" },
    { "metric": "req_failed", "expr": "rate<0.001" }
  ]
}
