Sub topic 1
How systems get connected: point-to-point, hub-and-spoke, and API-led
Prerequisites
This chapter assumes you know the following:
- Basic Salesforce concepts: objects, records, and the platform's APIs.
- What REST APIs and JSON are.
- What an integration between two systems is.
You do not need to know MuleSoft yet. Later chapters cover it.
Why the connection style matters
Every integration connects two systems. The harder question is how the whole set of connections is arranged. The arrangement decides how much work each new system adds, how many places break when one system changes, and who owns each connection.
This chapter describes three common styles. They are point-to-point, hub-and-spoke, and API-led. Each one is a way to organize connections, and none of them is tied to a particular product.
Point-to-point
In point-to-point, each system calls the others directly. Salesforce calls the ERP, the ERP calls the billing system, and so on. Each connection is custom code or configuration that knows the exact format and address of the system on the other end.
The Apex callout below is a point-to-point connection from Salesforce to an ERP. It uses a Named Credential, which stores the endpoint and authentication outside the code.
HttpRequest req = new HttpRequest();
req.setEndpoint('callout:ERP_Credential/orders/' + orderId);
req.setMethod('GET');
HttpResponse res = new Http().send(req);
if (res.getStatusCode() == 200) {
Map<String, Object> order = (Map<String, Object>) JSON.deserializeUntyped(res.getBody());
System.debug(order.get('status'));
}This is quick to build and easy to understand. With two or three systems it is often the right choice. The cost shows up as systems are added. With n systems, the number of possible connections grows as n(n-1)/2. Ten systems can need up to 45 separate connections, and each one must be maintained when either end changes.
Hub-and-spoke
In hub-and-spoke, every system connects to one central hub, and the hub routes messages between them. Each system (a spoke) only needs to know how to talk to the hub. Adding a system adds one connection instead of up to n.
The hub can also hold shared logic, such as format conversion and routing rules. This is the basic idea behind an enterprise service bus and many middleware products.
The trade-offs are real. The hub becomes a single point of failure and a possible bottleneck. A central team often owns it, and that team can become a queue that every project waits in.
API-led
API-led connectivity organizes connections into layers of reusable APIs instead of one central router. A common version has three layers:
- System APIs expose a back-end system, such as the ERP, in a stable and consistent way.
- Process APIs combine system APIs to carry out a business process, such as "fulfil an order".
- Experience APIs shape data for a specific consumer, such as a mobile app or Salesforce.
Each API has one job, so a change in one system affects only its system API. The next chapters and the later chapter on API-led connectivity cover the layers in more detail.
Comparing the three styles
| Style | Connections as systems grow | Reuse | Main risk |
|---|---|---|---|
| Point-to-point | Grows quickly, up to n(n-1)/2 | Low | Tangled, brittle connections |
| Hub-and-spoke | Grows linearly, one per system | Medium | Central bottleneck and ownership queue |
| API-led | Grows with reusable APIs | High | More design effort up front |
What to take forward
Salesforce's native tools, covered later, mostly create point-to-point connections. Middleware platforms provide the hub or the API layers. The decision between them depends on how many systems you connect and how much those connections will change.
Exercise
A company has 6 systems, all connected point-to-point. How many connections does a full mesh need? How many would hub-and-spoke need? Name one cost of the hub-and-spoke choice.
Show answer
A full mesh of 6 systems needs 6 × 5 / 2 = 15 connections. Hub-and-spoke needs 6, one per system. One cost is that the hub is a single point of failure and a bottleneck, and its owning team can become a queue for every project.
Exercise
In an API-led design, which layer would hide the details of the ERP, and which layer would shape data for a Salesforce screen?
Show answer
The system API hides the ERP's details. The experience API shapes data for the Salesforce consumer.