Sub topic 3
When Middleware Is the Better Choice
Assume you understand Salesforce objects, REST APIs, JSON, and basic integration patterns. Middleware is an integration layer between Salesforce and other systems. It can transform data, route messages, coordinate several API calls, and provide shared security and monitoring.
When middleware is the better choice
Choose middleware when an integration has several systems, complex transformations, or long-running workflows. It is especially useful when Salesforce should not contain knowledge of every external system.
Common signals include:
- One Salesforce event must update an ERP, data warehouse, and shipping service.
- Each system uses different field names, formats, or protocols.
- Failed messages need durable storage, retries, replay, or a failure queue.
- Several teams need reusable APIs instead of separate point-to-point connections.
- Integration monitoring and audit records must be managed centrally.
- The process must combine responses from multiple systems before updating Salesforce.
Cost, skills, and who runs it
Middleware adds license costs, deployment work, and a need for integration skills. The operating team must manage credentials, alerts, logs, versioning, and support for failed messages.
| Approach | Best fit | Main ownership |
|---|---|---|
| Native Salesforce | One or two systems with simple logic | Salesforce team |
| Middleware | Many systems and shared integration services | Integration platform team |
A native Flow, Apex callout, Named Credential, or Platform Event is often cheaper for a focused integration. Middleware can reduce long-term duplication when many integrations share transformations, policies, and monitoring.
> callout note > Do not compare only build cost. Include operations, incident response, testing, licensing, and the cost of changing the integration later.
Anti-patterns to avoid
- Adding middleware only because it is available.
- Recreating simple Salesforce automation in an external platform.
- Using point-to-point links until every system has many custom connections.
- Hiding business rules in transformations that nobody owns.
- Retrying non-idempotent operations without a duplicate-protection strategy.
A decision framework with worked scenarios
Ask these questions:
- How many systems and message paths exist?
- How complex are mapping, routing, and orchestration?
- What reliability, audit, and security controls are required?
- Who has the skills and capacity to operate each option?
- Will the design support likely future integrations?
For example, one Salesforce org making a single order-status request can use Apex and a Named Credential. A retailer sending order events to an ERP, warehouse, and analytics platform benefits from middleware because it needs shared routing, transformation, retries, and monitoring.
Exercise
A Salesforce org sends customer updates to one external REST service with simple JSON mapping. Should it start with middleware?
Show answer
No. Start with Salesforce native tools unless additional systems, reliability requirements, or transformation complexity justify middleware.