Overview
Salesforce supports multiple integration patterns to connect with external systems — synchronous, asynchronous, batch and event-driven. Choosing the right pattern depends on business requirements such as latency, throughput, reliability, and transactional behavior. Below are the commonly used Salesforce integration patterns with real-world use cases and best practices.
1. Remote Process Invocation — Request and Reply (Synchronous)
Description: A client calls Salesforce (or Salesforce calls an external system) and waits for an immediate response. Use this when the caller requires an immediate answer.
Common APIs: REST API, SOAP API, Apex callouts.
Use cases: Real-time quote validation, address verification, payment authorization.
Quick Apex example (HTTP callout):
Http http = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint('https://api.example.com/verify');
req.setMethod('POST');
req.setBody('{"id":"001xx000003DGbV"}');
HttpResponse res = http.send(req);
System.debug(res.getBody());
2. Remote Process Invocation — Fire and Forget (Asynchronous)
Description: The caller triggers a process and does not wait for a reply. Salesforce sends a message/request and continues processing.
Common technologies: Queues, Apex @future, Queueable, Platform Events.
Use cases: Sending asynchronous notifications to ERP, logging, off-loading long-running tasks.
3. Batch Data Synchronization (Bulk)
Description: Periodic bulk synchronization of data between systems — typically scheduled and high-volume.
Common APIs/Tools: Bulk API (v2), Data Loader, ETL tools (Informatica, Talend, MuleSoft).
Use cases: Nightly loads for reporting, historical data migration, data warehouse sync.
4. Publish-Subscribe (Event-Driven)
Description: Systems publish events and interested subscribers receive them. Ideal for decoupled, scalable architectures and near-real-time updates.
Salesforce features: Platform Events, Change Data Capture (CDC), Streaming API.
Use cases: Order status changes, inventory updates, downstream microservices reacting to CRM changes.
Platform Event publish example (Apex):
MyEvent__e event = new MyEvent__e(RecordId__c = '001xx000003DGbV');
Database.SaveResult sr = EventBus.publish(event);
System.debug('Published: ' + sr.isSuccess());
5. Remote Call-In (Inbound Integration)
Description: External systems initiate calls into Salesforce to create/update data or trigger processes.
Common APIs: REST/SOAP APIs, Apex REST, inbound Platform Event consumers.
Use cases: Webhooks from payment gateways, integrations where external systems must push updates to Salesforce in real time.
6. UI Update Based on Data Changes
Description: Update UIs without full page reloads by subscribing to server-side changes.
Technologies: Streaming API, Lightning Message Service + Platform Events, Lightning components using EMP API.
Use cases: Live dashboards, collaborative editing interfaces.
7. Data Replication and Data Virtualization
Description: Replication copies Salesforce data into an external store for analytics or cross-platform reporting. Virtualization keeps data in external systems and surfaces it in Salesforce on demand.
Tools: Heroku Connect, External Objects (Salesforce Connect), third-party replication tools.
Use cases: Real-time reporting in BI tools, large reference datasets that you don’t want to store in Salesforce.
Best Practices & Considerations
– Choose synchronous patterns only when low latency and immediate response are required; otherwise prefer async to improve resilience.
– Design for retries and idempotency (especially for fire-and-forget and webhooks).
– Monitor API limits and bulkify operations. Use Bulk API for large volumes.
– Use Platform Events or CDC for decoupled, near real-time integrations. They scale better than request/response for many subscribers.
– Secure integrations using OAuth 2.0, mutual TLS, IP allowlists, and named credentials in Salesforce.
– Consider middleware (MuleSoft, AWS, Azure) if you need orchestration, transformation, routing, and protocol bridging.
Quick Comparison Table (conceptual)
– Request & Reply: Synchronous, low latency, tight coupling.
– Fire & Forget: Asynchronous, higher throughput, eventual consistency.
– Batch: High throughput, scheduled, large volumes.
– Pub/Sub (Events/CDC): Near real-time, decoupled, scalable.
– Remote Call-In: External systems push data, depends on external availability.
– Replication/Virtualization: For analytics or large external datasets.
Conclusion
Salesforce provides a rich set of integration patterns — request/response, fire-and-forget, batch, and event-driven — plus tools (APIs, Platform Events, CDC, Bulk API, Salesforce Connect) to implement them. Select the pattern based on required SLAs, throughput, fault tolerance, and whether you need decoupling or immediate feedback.








Leave a Reply