What are the trade-offs between event-driven architecture and request-response (synchronous) architecture?
Suggested answer
Request-Response (Synchronous): The caller sends a request and waits for an immediate response. Simple, predictable, easy to debug. Best for operations requiring immediate confirmation (e.g., payment authorization, real-time data retrieval). Drawback: Tight coupling — if the downstream service is slow or unavailable, the caller is blocked. Governor limits are consumed while waiting.
Event-Driven (Asynchronous): The publisher fires an event and continues without waiting. Subscribers process events independently. Pros: Loose coupling, resilience to downstream failures, natural scalability, supports fan-out (multiple subscribers to one event). Cons: Harder to debug (no immediate feedback), eventual consistency, need to handle duplicate events and ordering guarantees.
In Salesforce: Use Platform Events or CDC for event-driven patterns. Use synchronous REST API for real-time request-response. A hybrid approach is common — synchronous for user-facing operations, event-driven for back-office processing and integrations.
Practice content for interview preparation; not an official vendor answer. Verify details against current product documentation.
Community comments (0)
No comments yet.
Sign in or create a free account to add a comment. Comments are moderated before they appear.