Programování
Expert
Claude
Webhook handler s retry logic
Implementace robustního webhook handleru s retry a idempotency.
Prompt text
Délka: Střední
Vytvoř webhook handler pro [WEBHOOK PROVIDER - např. Stripe, GitHub, Shopify].
**Requirements:**
**1. Verification:**
- Signature verification
- Timestamp validation
- Replay attack prevention
**2. Processing:**
- Parse webhook payload
- Event type routing
- Idempotency (deduplicate events)
- Transaction handling
**3. Retry Logic:**
- Exponential backoff
- Max retry attempts
- Dead letter queue
- Failure notifications
**4. Error Handling:**
- Return 200 immediately
- Process async (queue)
- Log all events
**5. Testing:**
- Mock webhooks
- Retry scenarios
Framework: [FRAMEWORK]. Queue: [REDIS/RABBITMQ/SQS]. Language: [LANGUAGE].
**Requirements:**
**1. Verification:**
- Signature verification
- Timestamp validation
- Replay attack prevention
**2. Processing:**
- Parse webhook payload
- Event type routing
- Idempotency (deduplicate events)
- Transaction handling
**3. Retry Logic:**
- Exponential backoff
- Max retry attempts
- Dead letter queue
- Failure notifications
**4. Error Handling:**
- Return 200 immediately
- Process async (queue)
- Log all events
**5. Testing:**
- Mock webhooks
- Retry scenarios
Framework: [FRAMEWORK]. Queue: [REDIS/RABBITMQ/SQS]. Language: [LANGUAGE].
Příklad použití
Vstup:
Vytvoř Stripe webhook handler pro payment events (success, failed). Framework: Express + TypeScript. Queue: Redis Bull. Include: signature verify, idempotency, retry (max 5×, exponential backoff).
Výstup:
Complete webhook handler: Express endpoint POST /webhooks/stripe, signature verification using stripe.webhooks.constructEvent, idempotency with Redis (store event IDs, TTL 24h), immediate 200 response then async processing via Bull queue, event routing (payment_intent.succeeded → updateOrder, payment_intent.failed → notifyCustomer), retry logic (5 attempts, delays: 1s, 2s, 4s, 8s, 16s), failed jobs → dead letter queue + Slack alert, comprehensive logging (event ID, type, processing time). Testing: mock Stripe webhooks, simulate failures, verify idempotency prevents duplicates.
Kde použít tento prompt?
Najděte vhodné AI nástroje pro použití tohoto promptu a maximalizujte jeho efektivitu.
Podobné prompty
Advanced AI Features - Deep Dive do Pokročilých Funkcí
Komplexní průvodce pokročilými funkcemi AI nástrojů - od extended context a multimodality po tool use, streaming, a fine-tuning. Naučte se využívat plný potenciál moderních AI systémů.
Programování
Zobrazit
Algoritmus optimalizace
Optimalizace algoritmu z O(n²) na O(n log n) nebo lepší.
Programování
Zobrazit
API design s REST best practices
Návrh RESTful API s dokumentací a error handling.
Programování
Zobrazit
CI/CD pipeline setup
Konfigurace GitHub Actions / GitLab CI pipeline s testing a deployment.
Programování
Zobrazit
Objevte další AI prompty
Prozkoumejte naši sbírku Programování promptů a najděte ty, které vám pomohou dosáhnout lepších výsledků.