No title

 

API-based integration and event-based integration are two core approaches in Salesforce, each suited to different scenarios.


API-Based Integration

  • Model: Request–Response (synchronous)

  • How it works: One system calls Salesforce (or vice versa) using APIs like REST, SOAP, or Bulk API, and waits for a reply.

  • Example: An e-commerce app calling Salesforce REST API to create an Order.

  • Best for: Real-time queries, direct updates, data synchronization, when you need immediate feedback.


Event-Based Integration

  • Model: Publish–Subscribe (asynchronous)

  • How it works: Salesforce publishes events (via Platform Events or CDC), and subscribers automatically react.

  • Example: An update in an Opportunity publishes an event → a marketing app listens and sends a follow-up email.

  • Best for: Real-time notifications, multi-system reactions, scalable and loosely coupled architectures.


Key Differences

AspectAPI-Based IntegrationEvent-Based Integration
ModelRequest–ResponsePublish–Subscribe
SynchronicityTypically synchronousAsynchronous
CouplingTighter (direct system-to-system calls)Loosely coupled (publisher doesn’t know subscribers)
Real-timeImmediate but requires explicit callReal-time push notifications
Error HandlingImmediate feedbackRequires monitoring/retry mechanisms

 Analogy

  • API-based → Like calling a restaurant to ask “Is my order ready?” (direct, immediate).

  • Event-based → Like the restaurant texting you automatically when your order is ready (asynchronous, decoupled).


In practice: Most Salesforce integrations use a mix of both — APIs for direct data exchange and events for real-time triggers/notifications.


Interview Questions & Answers

1. What is the difference between API-based and event-based integration in Salesforce?

Answer:

  • API-based integration uses a request–response model where one system makes an API call (REST, SOAP, Bulk) to interact with Salesforce synchronously.

  • Event-based integration uses a publish–subscribe model where Salesforce publishes events (via Platform Events or Change Data Capture) and subscribers react asynchronously.


2. When would you prefer API-based integration over event-based integration?

Answer:

  • Use API-based when you need immediate feedback, synchronous transactions, or direct CRUD operations (e.g., inserting records, querying data).

  • Example: Payment processing, where you need to know instantly if the payment succeeded.


3. When would you prefer event-based integration over API-based integration?

Answer:

  • Use event-based when you need real-time notifications, decoupled systems, or multiple subscribers reacting to the same change.

  • Example: A new Opportunity created in Salesforce automatically triggers downstream marketing and billing systems.


4. What are the advantages and disadvantages of API-based integration?

Answer:

  • ✅ Advantages: Real-time data, simple to implement, immediate error feedback.

  • ❌ Disadvantages: Tight coupling, dependency on system availability, scalability issues if many calls are made.


5. What are the advantages and disadvantages of event-based integration?

Answer:

  • ✅ Advantages: Loose coupling, scalable, multiple subscribers can react to the same event, real-time push notifications.

  • ❌ Disadvantages: Asynchronous (no immediate response), requires event monitoring/retry mechanisms, slightly more complex setup.


6. Can API-based and event-based integrations be used together?

Answer:
Yes. In most real-world Salesforce implementations, a hybrid approach is used.

  • Example: Use event-based (CDC) to notify systems about data changes. Then those systems use API-based calls if they need additional details or to perform follow-up actions.


7. Which Salesforce features support event-based integration?

Answer:

  • Platform Events (custom event definitions for business processes).

  • Change Data Capture (CDC) (publishes record changes automatically).

  • Streaming API (push topics based on SOQL).


8. How does error handling differ between API-based and event-based integrations?

Answer:

  • API-based: Errors are returned immediately in the response (e.g., 400, 401, 500).

  • Event-based: Errors must be handled via subscriber retry logic, dead-letter queues, or event replay (since the publisher doesn’t know the subscriber failed).


9. Which integration is better for scalability?

Answer:

  • Event-based → better for scaling across multiple subscribers and decoupled systems.

  • API-based can scale, but may hit API limits or require orchestration.


10. Quick Analogy Question (common in interviews)

Q: “How would you explain API-based vs Event-based integration to a non-technical stakeholder?”
Answer:

  • API-based is like calling a restaurant to ask if your food is ready (direct, immediate response).

  • Event-based is like the restaurant texting you when your food is ready (automatic, asynchronous).

0 Comments

Post a Comment

Post a Comment (0)

Previous Post Next Post