What core architectural best practices govern resilient, scalable enterprise integration design in Salesforce?
Answer
Basics: An integration is a contract between systems that fail independently. Good design asks: Is it real-time or batch? Who is the system of record? What happens when a call fails or repeats? How much volume and how many API calls? The Salesforce Integration Patterns catalog groups answers: Request and Reply, Fire and Forget, Batch Data Synchronization, Remote Call-In, UI Update Based on Data Changes, and Data Virtualization.
How it works:
- Define data ownership and direction per entity.
- Pick the pattern: synchronous request-reply for user-facing lookups; asynchronous fire-and-forget for non-blocking updates; Bulk API for volume; Salesforce Connect for virtualized reads; events for change notification.
- Secure it: OAuth, Named/External Credentials, least-privilege integration user, TLS.
- Make it reliable: idempotent operations, retries with backoff, dead-letter handling, logging with correlation IDs.
- Observe: dashboards on failures, API usage, event backlog.
Advanced / deep dive: Use event-driven designs: Platform Events, Change Data Capture and the Pub/Sub API (gRPC) instead of polling; events have a replay window of 72 hours, so subscribers must store the last replay ID and resync from source if they are down longer (verify the current retention for your event type). Use middleware (MuleSoft, an ESB or iPaaS) when you need transformation, orchestration, many consumers or protocol translation, rather than point-to-point spaghetti. Respect limits: 100 callouts per transaction, 120 seconds cumulative timeout, API request allocation per 24 hours, 25 concurrent long-running requests, and the rule that a callout cannot follow uncommitted DML. Design for bulk: accept lists, use Composite/Collections, and avoid one call per record. Version contracts and test with mocks. Plan for eventual consistency: no distributed transactions, so use compensating actions.