Programování Expert Claude

Microservices communication pattern

Implementace komunikace mezi microservices (REST/gRPC/message queue).

Prompt text

Délka: Střední
Navrhni communication pattern pro microservices:

**Services:**
1. [SERVICE 1] - responsibilities
2. [SERVICE 2] - responsibilities
3. [SERVICE 3] - responsibilities

**Communication Needs:**
[SCENARIOS - např. Service A needs data from Service B, async notifications]

**Pattern Type:**
[SYNCHRONOUS/ASYNCHRONOUS/HYBRID]

**Options:**
1. **Sync:** REST, gRPC
2. **Async:** Message queue (RabbitMQ, Kafka), Event bus

**Design:**
- API contracts (proto/OpenAPI)
- Error handling & retries
- Circuit breaker
- Service discovery
- Authentication (service-to-service)
- Monitoring & tracing

**Provide:**
- Architecture diagram (text description)
- Implementation examples
- Pros/cons of chosen pattern
- Failure scenarios

Stack: [STACK].
Interaktivní tvůrce

Příklad použití

Vstup:

Navrhni communication pro: Order Service, Payment Service, Notification Service. Scenarios: Order → Payment (sync verification), Payment success → Notification (async). Pattern: hybrid. Stack: Node.js, RabbitMQ.

Výstup:

Hybrid architecture: Order→Payment sync gRPC (immediate response needed, retry with exponential backoff, circuit breaker after 3 failures, 2s timeout), Payment→Notification async via RabbitMQ (event "payment.completed", durable queues, dead letter queue for failures, idempotent consumers). Service discovery: Consul. Auth: JWT for service-to-service. Monitoring: distributed tracing (OpenTelemetry). Proto contracts for gRPC, event schemas for RabbitMQ. Failure scenarios: Payment down (circuit breaker opens, fallback response), RabbitMQ down (retry publish, fallback to polling). Pros: sync where needed, async for flexibility. Cons: complexity, eventual consistency.

Kde použít tento prompt?

Najděte vhodné AI nástroje pro použití tohoto promptu a maximalizujte jeho efektivitu.

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ů.