Enterprise Application Integration Questions
Integration architecture across many heterogeneous enterprise systems, legacy and modern: how systems exchange data (synchronous calls, push, scheduled bulk or file transfer, messaging) and when each fits, point-to-point versus middleware designs, connectors and adapters, choosing a native connector, iPaaS or custom build, bridging SOAP/XML and REST/JSON, canonical data models and schema mapping, governing shared-schema change, system-of-record ownership, orchestration versus choreography, hybrid on-premises to cloud connectivity over outbound-only or flaky links, multi-tenant integration platforms with idempotent delivery and downstream rate limits, failure handling, dead-letter queues and reconciliation at integration seams, and phased delivery against poorly understood legacy systems. Excludes the design of a single API surface, API gateway and versioning mechanics, broker-level event streaming, data-platform ingestion, and vendor selection or cloud migration programmes covered elsewhere.
You must deliver a new checkout service that depends on a customer's SOAP-based legacy ERP, and nobody on the team knows the ERP well. Lay out a phased integration plan: what you learn and deliver in each phase, the smallest interfaces that prove the integration, who owns what, the main risks and how you mitigate them, and how you validate end to end.
Sample Answer
The idea in plain words
When you depend on a system nobody on your team understands, the biggest risk is not the code you write but the things you do not know yet: what the operations really do, which are safe to repeat, how often the system is down, and what its data means. So the plan is to learn cheaply first, prove the integration end to end with the smallest possible interface (a walking skeleton: a thin, working path from checkout to the ERP and back that does little but runs for real), and only then build breadth. SOAP (an XML message protocol described by a WSDL file, a machine-readable list of the service's operations and message shapes) is a detail; what matters is that the ERP is an unfamiliar system of record (the authority for orders, stock and prices).
Phased plan (assumed 10 weeks: 2 + 3 + 3 + 2)
Phase 0: Discover (weeks 1 to 2).
- Learn: get the WSDL, a test or sandbox ERP, sample data, the list of operations the checkout actually needs, authentication method, maintenance windows, rate and volume limits, and a named ERP expert who answers questions within a day.
- Deliver: a one-page map of the needed operations (for example look up price and stock, create order, read order status, cancel), a recorded set of real request and reply examples, and a risk log.
- Characterisation tests (tests that pin down what the system actually does today, not what the document says): call each needed operation with good and bad input and record the replies, including fault messages. The program under "Seeing the pieces work" shows what a recording looks like.
- Exit: every needed operation called successfully once from our code against the test ERP.
Phase 1: Walking skeleton (weeks 3 to 5).
- Smallest interfaces that prove the integration: (1)
GetPrice/Stockread, (2)CreateOrderwrite in the test ERP, (3)GetOrderStatusread. Wrap them behind our own small interface inside an adapter (an anti-corruption layer: code that translates between the ERP's vocabulary and ours so ERP quirks stay out of checkout). - Build in from the start: timeouts, a unique client reference on every order (a key the checkout generates and the ERP stores, so a lost reply can be resolved by looking the order up), and logging of request ids.
- Exit: one test order goes from checkout to the test ERP and its status returns, repeatably, in a pipeline run.
Phase 2: Real checkout path (weeks 6 to 8).
- Add the rest: cancellation, partial stock, tax and price rules, error mapping, retry with backoff and jitter on reads (waits that grow after each failure, with random variation so many callers do not retry together), a stored idempotency record for writes (a saved note of each order's unique key and outcome, so a repeat returns the same result instead of creating a second order), and a reconciliation job (a scheduled comparison of checkout orders with ERP orders that lists differences).
- Run in shadow mode: for real checkouts, send orders to the ERP test system in parallel with the old process and compare results.
- Exit: shadow comparison matches on an agreed share of orders, differences explained. Example values to negotiate with the customer: at least 98 percent of orders match and every difference has a known cause.
Phase 3: Harden and launch (weeks 9 to 10).
- Load test up to the ERP's stated limits, failure drills (ERP down, slow, returns a fault mid-order), a feature flag (a setting that turns the ERP path on or off without a deploy), a runbook (step-by-step instructions for whoever is on call), alerts, then a pilot with a small share of traffic, then ramp up.
- Exit: pilot runs without unexplained mismatches for an agreed number of days (for example 10 consecutive days); rollback rehearsed.
Check of the span: 2 + 3 + 3 + 2 = 10 weeks, and every phase has an exit condition, not just an end date.
Who owns what
| Area | Owner |
|---|---|
| Checkout service and the adapter code | our team (a named tech lead) |
| ERP behaviour, data meaning, test environment, change calendar | customer's ERP owner (named person) |
| Credentials and network access | customer's security/IT with our requester |
| Business rules (prices, cancellation policy) | customer's business owner, decisions written down |
| Acceptance of end-to-end results | joint: our product owner and customer's business owner |
Write this down in week 1; most delays in these projects trace to a question with no owner.
Main risks and mitigations
| Risk | Mitigation |
|---|---|
| Documentation does not match behaviour | characterisation tests; keep recordings as regression tests |
| Create call times out and the outcome is unknown | client reference on every order; look up before any resend; never blind retry |
| Test ERP differs from production | compare configuration with the ERP owner; run shadow mode against production-like data; pilot before ramp |
| ERP maintenance windows or slowness | queue orders in checkout during windows; timeouts and a circuit breaker (stop calling a failing dependency for a while) |
| Only one person knows the ERP | pair on every phase-0 call; record decisions in a shared log |
| Data quality (duplicate customers, odd codes) | validate at the adapter, reject with reason, sample real data early |
| Scope growth | the interface list in phase 0 is the scope; additions go through the owner |
Validating end to end
- Contract tests at the adapter (tests that check the adapter still sends and understands the message shapes the ERP really uses, by replaying the recorded replies from phase 0).
- One automated scenario per business path (happy order, out of stock, cancel, ERP fault, ERP down) from checkout API to ERP status and back.
- Reconciliation: after each day, compare order counts and totals between checkout and ERP; any difference opens a ticket.
- Traces with one correlation id (an identifier passed along with the order through every system) across checkout, adapter and ERP request, so any order can be followed.
Seeing the pieces work
The program uses a simulated ERP test system (illustrative; the operations and codes are invented). It shows three things: recorded request and reply pairs from characterisation, including faults; a create call whose reply is lost, resolved by looking the order up by client reference instead of sending it again; and a shadow comparison whose exit check uses the example thresholds above and fails when a difference has no known cause.
class TestErp:
"""Simulated ERP test system (illustrative, not a real product)."""
def __init__(self):
self.orders = [] # (order id, client reference); this ERP does not dedupe on the reference
self.drop_next_reply = False
def call(self, op, req):
if op == "GetPrice":
prices = {"P-1": "12.50"}
if req["sku"] not in prices:
return {"fault": "Client", "code": "SKU_UNKNOWN"}
return {"price": prices[req["sku"]], "stock": 7}
if op == "CreateOrder":
if req["qty"] <= 0:
return {"fault": "Client", "code": "QTY_INVALID"}
oid = "A-%04d" % (len(self.orders) + 1)
self.orders.append((oid, req["clientRef"])) # every create makes a new order
if self.drop_next_reply: # order stored, reply lost
self.drop_next_reply = False
raise TimeoutError("no reply")
return {"orderId": oid, "status": "created"}
if op == "GetOrderByRef":
for oid, ref in self.orders:
if ref == req["clientRef"]:
return {"orderId": oid, "status": "created"}
return {"fault": "Client", "code": "NOT_FOUND"}
erp = TestErp()
print("-- characterisation: good and bad input, replies recorded")
recordings = []
for op, req in [("GetPrice", {"sku": "P-1"}), ("GetPrice", {"sku": "X-9"}),
("CreateOrder", {"sku": "P-1", "qty": 0, "clientRef": "r-0"})]:
reply = erp.call(op, req)
recordings.append((op, req, reply))
print(op, req, "->", reply)
print("-- skeleton: create with a client reference, survive a lost reply")
def create_order(erp, req):
try:
return erp.call("CreateOrder", req)
except TimeoutError:
found = erp.call("GetOrderByRef", {"clientRef": req["clientRef"]}) # look up before any resend
return found if "orderId" in found else erp.call("CreateOrder", req)
erp.drop_next_reply = True
print(create_order(erp, {"sku": "P-1", "qty": 2, "clientRef": "r-1"}))
print("orders held by the ERP:", len(erp.orders))
blind = TestErp() # contrast: resend at once, with no lookup
blind.drop_next_reply = True
try:
blind.call("CreateOrder", {"sku": "P-1", "qty": 2, "clientRef": "r-1"})
except TimeoutError:
blind.call("CreateOrder", {"sku": "P-1", "qty": 2, "clientRef": "r-1"})
print("blind resend instead, orders held by the ERP:", len(blind.orders))
print("-- shadow comparison")
old_total = {i: 1000 + i for i in range(1, 201)} # old process, cents
new_total = {i: v + (1 if i % 66 == 0 else 0) for i, v in old_total.items()} # ERP path: tax rounding
known_causes = {66: "tax rounding", 132: "tax rounding", 198: "tax rounding"} # triaged by hand with the ERP owner
def shadow_exit(old, new, causes):
diffs = [i for i in old if old[i] != new[i]]
unexplained = [i for i in diffs if i not in causes]
rate = (len(old) - len(diffs)) / len(old)
return rate, len(diffs), len(unexplained), rate >= 0.98 and not unexplained
rate, differing, unexplained, ok = shadow_exit(old_total, new_total, known_causes)
print("match rate:", round(rate * 100, 1), "percent; differing:", differing, "; unexplained:", unexplained)
print("exit met (example thresholds: at least 98 percent matching, 0 unexplained):", ok)
new_total[7] += 40 # one order differs for a reason nobody has triaged
rate, differing, unexplained, ok = shadow_exit(old_total, new_total, known_causes)
print("with one untriaged difference: match rate", round(rate * 100, 1), "percent; unexplained:", unexplained, "; exit met:", ok)
Output:
-- characterisation: good and bad input, replies recorded
GetPrice {'sku': 'P-1'} -> {'price': '12.50', 'stock': 7}
GetPrice {'sku': 'X-9'} -> {'fault': 'Client', 'code': 'SKU_UNKNOWN'}
CreateOrder {'sku': 'P-1', 'qty': 0, 'clientRef': 'r-0'} -> {'fault': 'Client', 'code': 'QTY_INVALID'}
-- skeleton: create with a client reference, survive a lost reply
{'orderId': 'A-0001', 'status': 'created'}
orders held by the ERP: 1
blind resend instead, orders held by the ERP: 2
-- shadow comparison
match rate: 98.5 percent; differing: 3 ; unexplained: 0
exit met (example thresholds: at least 98 percent matching, 0 unexplained): True
with one untriaged difference: match rate 98.0 percent; unexplained: 1 ; exit met: False
The first section shows one recording per line: the operation, the request sent and the reply or fault received, which later become regression tests. The second shows the order stored in the ERP even though the reply never arrived; the adapter found it by its reference, so the ERP holds one order, not two. The simulated ERP makes a new order on every create call, so the contrast line shows what a blind resend does: two orders for one checkout. The third compares 200 orders between the old process and the ERP path: three differ by a one-cent tax rounding difference, and each is in the list of causes triaged by hand, so the match rate is 98.5 percent and the example exit check passes. When one more order differs for a reason nobody has triaged, the match rate is 98.0 percent, exactly on the 98 percent line and so still passing it, yet the exit fails because that difference has no known cause: the percentage alone would not have caught it.
Common mistakes
- Building the whole checkout first and integrating last.
- Trusting the WSDL as the full truth.
- No named ERP contact.
- Retrying order creation without a way to detect that it already exists.
Running the code
Save the program as erp_demo.py and run python erp_demo.py (Python 3.12, standard library only).
Design a hybrid integration between an on-premises ERP and cloud services that handle order fulfillment. How do you get data out of the ERP securely, which transfer modes would you use for which data, how do you cope with latency and throughput limits and intermittent connectivity, and how do you keep an audit trail for compliance?
Sample Answer
The idea in plain words
An on-premises ERP (enterprise resource planning system holding orders, stock and finance) is the customer's system of record: the system whose copy of the data is the authoritative one. It sits behind a firewall, was not built for heavy outside traffic, and its owners fear anything that slows it. A hybrid integration (part on the customer's network, part in the cloud) must therefore do four things: take data out without opening the ERP to the internet, choose the right transfer mode per kind of data, survive slow or broken links without losing or duplicating anything, and leave a trail an auditor can follow. The skeleton to state first is: an outbound-only agent, one transfer mode per kind of data, an outbox with idempotent replay for outages, and an append-only audit trail. Step 4 adds the cutover method for moving a feed from an old path to the new one, which is also how a SaaS product is connected to a customer's legacy database with little downtime: copy everything once, then keep up with changes, then switch.
Design, step by step
1. Getting data out securely.
- Put a small integration agent inside the customer network. It opens only outbound TLS connections (port 443) to the cloud, so the customer opens no inbound port. Connections are mutually authenticated (mTLS: both sides present certificates) or use short-lived tokens; a private link or a site-to-site VPN (an encrypted tunnel between the customer's network and the cloud network) is the alternative if the customer's policy requires it.
- Read the ERP through its supported interfaces in this order of preference: its published API or business events, an export or staging table it provides, and only then database-level change capture (reading the database's change log, which records every insert and update), agreed with the ERP owner. Do not write straight into ERP tables, which bypasses its business rules. Use a read-only account, ideally against a replica or a reporting copy (a read-only copy of the data that the database keeps up to date), so the integration cannot hurt order entry.
- Payloads are encrypted in transit, and sensitive fields are minimised: send only fields the cloud side needs.
2. Transfer mode per kind of data.
| Data | Mode | Why |
|---|---|---|
| New orders into the ERP, shipment and status events back | event messages through a durable queue | small, needs seconds-level latency, must not be lost |
| Product, price and customer master data | initial bulk backfill, then incremental change capture | large once, small deltas after |
| Inventory positions | periodic snapshot (for example every 15 minutes) plus event for large changes | stale by at most one interval; cheap |
| Historical or archive data | bulk files, off-peak, throttled | big, not urgent |
| Compliance extracts | scheduled file with checksum | reproducible |
3. Latency, throughput and intermittent connectivity: size it. Assumptions (stated, not measured): 20,000 orders a day, 80 percent of them in an 8-hour business window, 4 KB per message.
- Business-hours rate: 16,000 orders / (8 x 3,600 = 28,800 seconds) = 0.556 orders per second. At 4 KB each that is about 2.2 KB per second, trivial for any link. So the link's capacity is not the risk; its availability is.
- Link outage of 4 hours (14,400 seconds) in the window: 0.556 x 14,400 = 8,000 orders wait in the on-prem outbox (a durable local table or queue where messages are stored before being sent).
- On recovery, replay at a deliberately limited 20 messages per second. This figure is an assumption: it stands for a limit the ERP owner sets on integration traffic (for example 25 messages per second) with some headroom left for normal order entry. The ERP is not flooded. New orders keep arriving at 0.556 per second, so the net drain is 20 - 0.556 = 19.44 per second, and the backlog clears in 8,000 / 19.44 = about 411 seconds (about 7 minutes). The program in step 5 recomputes these sizing figures.
- Backfill sizing: 5,000,000 master data rows at 1 KB each is 5,000,000 KB = 5,000 MB (decimal). Throttled to 2 MB per second to protect the ERP, it takes 5,000 / 2 = 2,500 seconds, about 41.7 minutes. Run it off-peak, in resumable batches with a saved position.
- Every message carries a unique id and the receiver dedupes on it (at-least-once delivery plus an idempotent receiver, one that gives the same result if a message arrives twice), because retries after an outage will create duplicates.
4. Minimal-downtime cutover (initial load, change capture, switch).
- Start capturing changes from a recorded position (a bookmark in the database's change log, such as a log position or timestamp, marking the last change already handled) before the backfill begins, and store them in a staging area.
- Run the backfill in batches into the cloud store. It is idempotent: each row is written by business key, so a rerun produces the same state.
- Replay the captured changes on top, in order per record. Because replay is also keyed, the overlap between backfill and capture is harmless.
- Run both in parallel in shadow mode (the new path processes real data alongside the old one, but its results are only compared, not used) and compare counts and checksums per table every day until differences are zero or explained.
- Cut over by flipping a switch (a feature flag: a setting that turns a behaviour on or off without redeploying) so the cloud uses the new feed; the legacy source is untouched.
- Rollback is flipping the switch back; since the integration only read from the legacy system, it has nothing to undo there. Keep change capture running for an agreed period after cutover so rollback loses nothing.
Handling the customer's concern about disruption. State the guarantees in terms the customer can verify: read-only access, throttled to a stated rate, runs on a replica or off-peak, no schema change in the ERP, a kill switch the customer controls (one control that stops the integration immediately), and a rehearsal in their test system first. Concern is answered by limiting what the integration can do to them, not by arguing.
5. Audit trail for compliance. For each business message keep an append-only record (rows are only ever added, never edited): message id, correlation id (one id that follows the order through every system), source system and record version, time, who or what acted, outcome, and a hash of the payload (a fixed-length fingerprint of the message: change one character and the hash changes completely, so it proves the payload was not altered without storing it again). Store it in write-once storage (records can be added but not changed) or tamper-evident storage (any change can be detected), with a retention period set by the customer's policy, restricted to read for auditors.
The program below shows what the rows look like. Each row also stores the previous row's hash and its own hash over both, so editing an old row breaks the chain. A chain alone only exposes a careless edit: anyone who can write to the log can change a row and recompute every later hash, or drop the last rows, and the result still verifies. So the newest hash (the chain head) is also copied to a place the log's writers cannot change, for example write-once storage in a separate account or a signed daily report sent to the auditor, and verification compares the recomputed head with that copy. The program shows all three attacks. The business-hours rate, backlog, drain time and backfill time from step 3 are recomputed at the end. Illustrative rows with invented ids.
import hashlib
import json
def sha(text):
return hashlib.sha256(text.encode()).hexdigest()
def append(log, row):
prev = log[-1]["hash"] if log else "0" * 64
body = json.dumps(row, sort_keys=True)
log.append({**row, "prev": prev, "hash": sha(prev + body)})
def verify(log, anchor=None):
prev = "0" * 64
for i, r in enumerate(log):
row = {k: v for k, v in r.items() if k not in ("prev", "hash")}
if r["prev"] != prev or r["hash"] != sha(prev + json.dumps(row, sort_keys=True)):
return f"broken at row {i}"
prev = r["hash"]
if anchor is not None and prev != anchor:
return "chain is self-consistent but its head differs from the anchor"
return "chain intact"
payload = json.dumps({"orderId": "A-1001", "qty": 2}, sort_keys=True)
log = []
append(log, {"message_id": "m-001", "correlation_id": "c-77", "source": "erp",
"record_version": 3, "time": "2027-03-01T10:00:00Z",
"actor": "integration-agent", "outcome": "delivered",
"payload_sha256": sha(payload)})
append(log, {"message_id": "m-002", "correlation_id": "c-77", "source": "cloud-oms",
"record_version": 1, "time": "2027-03-01T10:00:02Z",
"actor": "fulfilment-service", "outcome": "accepted",
"payload_sha256": sha(payload)})
for r in log:
print(r["message_id"], r["correlation_id"], r["source"], "v" + str(r["record_version"]),
r["time"], r["actor"], r["outcome"], r["payload_sha256"][:12], r["hash"][:12])
anchor = log[-1]["hash"] # copied to storage the log's writers cannot change
print(verify(log, anchor))
# 1. a casual edit of one row
edited = [dict(r) for r in log]
edited[0]["outcome"] = "rejected"
print("after editing row 0:", verify(edited, anchor))
# 2. an editor with write access rewrites row 0 and recomputes every later hash
forged = []
for r in log:
row = {k: v for k, v in r.items() if k not in ("prev", "hash")}
if row["message_id"] == "m-001":
row["outcome"] = "rejected"
append(forged, row)
print("forged chain, no anchor:", verify(forged))
print("forged chain, with anchor:", verify(forged, anchor))
# 3. the last row is dropped
print("last row dropped, with anchor:", verify(log[:1], anchor))
rate = 16000 / (8 * 3600)
print("business-hours rate:", round(rate, 3), "orders/s,", round(rate * 4, 1), "KB/s")
backlog = rate * 4 * 3600
print("backlog after 4 h outage:", round(backlog))
print("drain time at 20/s:", round(backlog / (20 - rate)), "s")
print("backfill at 2 MB/s:", round(5_000_000 / 1000 / 2), "s =", round(5_000_000 / 1000 / 2 / 60, 1), "min")
Output:
m-001 c-77 erp v3 2027-03-01T10:00:00Z integration-agent delivered dd716531a4f8 21b31c68a4d9
m-002 c-77 cloud-oms v1 2027-03-01T10:00:02Z fulfilment-service accepted dd716531a4f8 feb0015e69c8
chain intact
after editing row 0: broken at row 0
forged chain, no anchor: chain intact
forged chain, with anchor: chain is self-consistent but its head differs from the anchor
last row dropped, with anchor: chain is self-consistent but its head differs from the anchor
business-hours rate: 0.556 orders/s, 2.2 KB/s
backlog after 4 h outage: 8000
drain time at 20/s: 411 s
backfill at 2 MB/s: 2500 s = 41.7 min
The first two lines are two audit rows for the same order (the shared c-77 is the correlation id): one when the agent delivered the ERP message, one when the cloud service accepted it. The identical dd716531a4f8 is the payload hash prefix, showing the payload was unchanged between systems. The last column is the row's chain hash. Editing one row is caught at that row. A rewritten chain with every hash recomputed passes on its own, and only the comparison with the stored head exposes it; the same comparison catches a dropped last row. That is how an auditor can show no recorded order was altered: the log is tamper-evident when its head is held somewhere the log's writers cannot reach. The final four lines match the sizing arithmetic in step 3. Add a daily reconciliation report: counts and amounts per day on each side, with differences explained or ticketed. Keep personal data in logs minimal.
Failure modes and signals
- Link down: outbox grows. Alert on outbox age, not just errors.
- ERP slow: backpressure (the receiver tells the sender to slow down) through the throttle; never retry in a tight loop.
- Duplicate order after a restart: stopped by the id check.
- Silent loss: found only by reconciliation, so it is not optional.
Common mistakes
- Opening an inbound firewall rule for convenience.
- One transfer mode for everything.
- Sizing by bandwidth when availability is the issue.
- A cutover with no rollback and no comparison period.
Running the code
Save the program as audit_demo.py and run python audit_demo.py (Python 3.12, standard library only).
An integration must reach an on-premises ERP behind a flaky VPN, with strict rules that data stays inside the customer's boundary and with outbound-only traffic through proxies and tight egress controls. Design the integration architecture to keep business disruption minimal: what runs on-prem, how data moves, what happens when the link is down, how it authenticates, and how you size the delivery effort and risk.
Sample Answer
The idea in plain words
The customer's rules decide the shape of the design. "Data stays inside the boundary" means the part of the integration that touches business data must run inside the customer's network. "Outbound-only through proxies" means nothing outside may open a connection into that network, so everything must be started from the inside. "Flaky VPN" (virtual private network, an encrypted tunnel between sites) means the link will drop, so the integration must keep working, and keep its promises about data, while the link is down.
The design that fits all three is a local runtime with a remote control plane (the control plane is the part that configures, schedules and monitors; the data plane is the part that carries the business records, and here it stays inside). A small agent (a connector process) runs on-premises next to the ERP (enterprise resource planning system, the system of record for orders, stock, finance). It reads from and writes to the ERP, transforms the data, and stores everything it cannot deliver yet in a durable local queue. It only ever dials out. The cloud side holds configuration, schedules and monitoring, and receives only the data fields the customer has approved for export. If the link fails, the agent keeps working and catches up afterwards.
Step 1: clarify before drawing anything
| Question | Why it changes the design |
|---|---|
| Which data may cross the boundary: nothing, metadata only, or a named field list? | Decides whether the cloud ever sees payloads at all |
| Which systems must the integration talk to, and in which direction? | Read-only extraction is far lower risk than writing to the ERP |
| How fresh must data be, and how long an outage must we survive? | Sets the polling interval, the buffer size and the drain plan |
| Is the proxy TLS-inspecting (it decrypts and re-encrypts traffic)? | If yes, client certificates cannot be used end to end |
| Who can approve firewall rules, and how long does that take? | Often the longest item on the calendar, not the code |
Step 2: what runs on-prem, and how data moves
ERP (system of record) customer network | boundary cloud
| adapter (API, DB view, +-----------------------------+ |
| file drop, SOAP) | integration agent (per | |
+--------------------------> | subnet): transform, validate| ---- outbound HTTPS 443 ---> ingestion
| durable disk queue (log) | <--- commands/config pulled endpoint
+-------------+---------------+ | via the same outbound
| authenticating proxy | connection (poll/long-poll)
+---------------------> |
How to read the diagram: the left box is the ERP, the middle box is the agent running inside the customer network, and the vertical bar is the network boundary. Every arrow that crosses the boundary is a connection the agent opens from the inside. The cloud never opens one. The commands/config pulled arrow is not a second connection: it is the agent asking the cloud, over the same outbound HTTPS, whether there is anything for it to do, and the cloud answers in that reply.
One message, named, to follow it through: ERP order 4711 changes status to SHIPPED. (1) The agent's adapter reads the change from the ERP. (2) It maps the record to the shared message shape and drops every field not on the approved list, for example the customer's phone number. (3) It appends the message, with id order-4711-v3, to the disk queue. (4) It posts a batch containing that message to the ingestion endpoint through the authenticating proxy. (5) The cloud stores it, replies 200, and only then does the agent delete order-4711-v3 from its queue. If the link is down at step 4, the message simply stays in the queue and step 4 is retried later.
- Adapter on-prem. The agent talks to the ERP with whatever interface the ERP offers (a SOAP or REST API, a database view, a file export). The ERP is never exposed to the internet.
- Transform and filter at the source. The agent maps ERP records to the shared message shape and strips every field that is not on the approved export list (the allowlist), or replaces a sensitive value with a meaningless stand-in called a token while the real value stays on-prem. This is how "data stays inside" is enforced in code: the filter runs inside the boundary, before anything is queued for sending.
- Durable local queue. Each message is written to disk (an append-only log or an embedded database) before it is acknowledged to the source. Only after the cloud acknowledges receipt is it removed. This is store-and-forward: hold the message now, send it when the link allows.
- Outbound pull and push over one port. The agent opens HTTPS (port 443, outbound) to the ingestion endpoint. It pushes batches up, and it polls (or long-polls, meaning the server holds the request open until there is something to say) for commands and configuration. No inbound firewall rule is needed.
- One forwarder agent per subnet or network zone. A subnet is a separate address range inside the customer network, and zones are often walled off from each other. Segmented networks often cannot reach each other, so each zone runs an agent with its own disk buffer. A zone agent forwards to the one that has proxy access, or each has its own approved proxy route. This avoids a single choke point and keeps a failure to one zone.
- Cloud side keeps only what is allowed. Ingestion stores approved fields in the customer's region, and the control plane keeps run status, counts and error codes, never payloads.
Step 3: authentication and the proxy
Proxy authentication. A corporate proxy often answers the agent's CONNECT request (the request that asks the proxy to open a tunnel) with 407 Proxy Authentication Required and a Proxy-Authenticate header (407 is the proxy's own version of 401: it asks for credentials meant for the proxy, not for the destination) naming the scheme, such as Negotiate (which carries Kerberos, a ticket-based protocol used inside Windows domains) or NTLM (an older challenge-response scheme). The agent then repeats the request with a Proxy-Authorization header. Illustrative exchange:
CONNECT ingest.example.com:443 HTTP/1.1
Host: ingest.example.com:443
HTTP/1.1 407 Proxy Authentication Required
Proxy-Authenticate: Negotiate
Content-Length: 0
CONNECT ingest.example.com:443 HTTP/1.1
Host: ingest.example.com:443
Proxy-Authorization: Negotiate <base64 ticket>
The <base64 ticket> in the last request is a Kerberos ticket: a short-lived proof of identity that the agent obtains from the domain's Kerberos server using its own service account, then sends as base64 text (a way of writing binary data using only printable characters). Prefer Kerberos with a dedicated service account for the agent. Its credentials sit in a keytab (a protected file holding the service account's key, so the agent can get tickets without a person typing a password) or the OS credential store, never in a config file in plain text. NTLM is weaker and is a fallback for proxies that offer nothing else. Ask for an allowlist rule (a firewall or proxy entry that explicitly permits one destination) for the ingestion hostname so the agent does not depend on a human user's session.
Authenticating to the cloud. There are two common choices. A first design needs only one of them; the proxy sign-in above, the local queue and outbound HTTPS are the parts that must exist on day one.
| Option | Strength | Weakness here |
|---|---|---|
| mTLS (mutual TLS, both sides present certificates) | Strong identity at the connection level | A TLS-inspecting proxy ends the connection, so the cloud never sees the agent's certificate; needs a passthrough rule and certificate rotation work |
| Short-lived access token (for example an OAuth 2.0 client-credentials grant, signed with a private key the agent holds) | Works through inspection, expires in minutes, revocable | Needs a secure place for the signing key and a token refresh path that still works when the link is flapping |
My recommendation: use short-lived tokens as the baseline because they survive an inspecting proxy, keep the private key in the host's key store, and add mTLS only if the customer's proxy passes the tunnel through untouched. Rotate keys on a schedule and make the agent refuse to run on a clock that is badly wrong, since token validity depends on time.
Step 4: what happens when the link is down
- The agent keeps reading from the ERP and writing to the disk queue. Nothing is lost while the disk has room.
- Sending retries with exponential backoff and jitter (a random wait that grows after each failure, so a recovering link is not hit by every agent at once). Between attempts the agent probes cheaply, so it notices recovery quickly.
- Every message carries an id and a per-entity sequence number. The cloud side deduplicates on the id, so redelivery after a half-completed batch is harmless (the link can drop after the cloud stored a batch but before the agent saw the acknowledgement).
- Order matters per business entity (an order's update 3 must not overtake update 2), not across the whole stream. The cloud applies per-entity order using the sequence number.
- The queue has a size limit and a stated policy for when it fills. For example: alert at 70 percent, then pause low-priority feeds and keep critical ones, and never silently drop. The policy is agreed with the customer in advance.
- After recovery the agent drains the backlog at a capped rate so catch-up traffic does not starve live traffic or saturate the shared VPN.
- A daily reconciliation compares counts and control totals (the sum of a numeric column, such as order amounts, computed on both sides and compared) per entity between the ERP extract and what the cloud holds, and reports gaps. This is the safety net that proves the buffer worked.
Air-gapped fallback (needed only if no live link is allowed). Air-gapped means the network has no live connection to the outside. If the customer needs a mode with no live link at all (or the link is down for days), the agent writes signed export files: a batch of records, a manifest with record count, a hash of the content and a batch sequence number. A person carries the file across (or it passes through an approved transfer point), and an importer on the other side verifies the signature, the hash and that the sequence number has no gap, then loads it with the same deduplication. This is slower but uses the same message format, so it is a transport swap, not a second system.
Step 5: sizing bandwidth, disk and drain time
The inputs below are assumptions for the example, to be replaced with measured volumes in discovery.
- 200,000 messages per day, 4 KB (kilobytes, decimal) each.
- Traffic is uneven: 60 percent of the day's messages arrive in an 8-hour business window, and short bursts inside that window (a few minutes) reach 10 times the daily average rate. A whole business day cannot run at 10 times the average, because the day's total would then be several times 200,000.
- The outage to survive is 8 hours that covers the whole business window (the worst case), and 3 days for the disk limit.
- The VPN offers 10 Mbit/s and the integration may use at most half of it while draining.
Step by step:
- Daily volume: 200,000×4 KB=800,000 KB=800 MB.
- Average rate: 800,000 KB/86,400 s≈9.26 KB/s≈74 kbit/s (multiplying by 8 bits per byte).
- Burst at 10 times: about 741 kbit/s, which is 0.74 Mbit/s, well under a 10 Mbit/s link. Steady-state bandwidth is therefore not the constraint; the drain is.
- Backlog after an 8-hour outage over the business window: 0.6×200,000=120,000 messages, which is 120,000×4 KB=480 MB. (An 8-hour outage at night holds far less: 200,000/24×8≈66,667 messages, about 267 MB if traffic were even.)
- Drain at 5 Mbit/s (half the link): 480 MB×8=3,840 Mbit, and 3,840/5=768 s≈12.8 minutes. Live traffic arriving during the drain in the business window averages 120,000×4 KB×8/28,800 s≈0.13 Mbit/s, which stretches the drain to about 13 minutes if the drain shares the 5 Mbit/s budget, so it does not change the conclusion.
- Disk for 3 days: 800 MB×3=2,400 MB; with a 2 times safety factor (for retries, indexes and growth) provision about 4.8 GB per agent that carries the whole feed.
Latency is a different calculation: the agent batches (for example up to 100 messages or 1 second), so end-to-end delay in a healthy state is dominated by the batch wait plus one round trip through the proxy, which the pilot measures.
Step 6: sizing the delivery effort and risk
This step is project planning rather than architecture, and interviewers often ask it as a closing question. A three-point estimate (also called a PERT estimate) per work item, in engineer-weeks, using (O+4M+P)/6 where O is optimistic, M is most likely and P is pessimistic. These O, M and P values are assumptions for a team of three.
| Work item | O | M | P | Expected |
|---|---|---|---|---|
| Discovery, access and firewall approvals | 2 | 3 | 6 | 3.33 |
| Agent, disk queue, retry and drain | 4 | 6 | 9 | 6.17 |
| Proxy and authentication | 2 | 3 | 8 | 3.67 |
| ERP adapter and field filter | 3 | 5 | 10 | 5.50 |
| Security and performance testing | 3 | 4 | 7 | 4.33 |
| Pilot and cutover | 2 | 3 | 5 | 3.17 |
| Total | 26.17 |
Variance is a measure of spread (the average squared distance from the expected value), and the standard deviation is its square root. For independent items the variance of the total is the sum of the item variances, and each item's variance is ((P−O)/6)2=(P−O)2/36. The six values of (P−O)2 are 16, 25, 36, 49, 16 and 9, which sum to 151. So the summed variance is 151/36≈4.19, the standard deviation is 4.19≈2.05 weeks, and a two-standard-deviation range is 26.17±4.10, about 22.1 to 30.3 engineer-weeks. If the work divides evenly across three engineers (perfect parallelism, which real projects never reach), that is 22.1/3≈7.4 to 30.3/3≈10.1 calendar weeks, with a midpoint of 26.17/3≈8.7. Handoffs and shared dependencies make the upper end the safer figure to quote. Approvals by the customer's security and network teams run on their calendar, not ours, so I would quote the approvals as a separate dependency with a date.
Top risks, with the mitigation each gets: (1) firewall and proxy approvals slip, so start the requests in week one and use a test endpoint; (2) the ERP has no good change feed, so budget for polling on a modified-date column and test its cost on the ERP; (3) TLS inspection breaks the chosen authentication, so test through the real proxy early; (4) disk fills during a long outage, so ship the size limit and alert before go-live; (5) a bad field filter leaks data, so make the allowlist reviewed code with tests, not a setting.
Step 7: test plan
- Security tests: scan the host for open inbound ports (expect none); confirm payloads never appear in cloud logs; use an expired token and a wrong clock to confirm the agent stops and alerts; confirm the field filter drops a field that is not on the list.
- Performance tests: replay a day of recorded or synthetic messages with bursts at 10 times the average, then throttle the link to the planned 5 Mbit/s and measure drain time against the 13 minute estimate.
- Failure tests: cut the link mid-batch, kill the agent between writing to disk and sending, fill the disk to the alert threshold, and restart the proxy; after each, the reconciliation report must show zero missing and zero duplicate records.
Judgment
I would commit to the local-runtime, outbound-only agent with store-and-forward, short-lived-token authentication, a field allowlist enforced on-prem, and a daily reconciliation. What would change it: if the customer allows no outbound connection at all, the signed-file path becomes the primary transport; if the proxy passes tunnels through, add mTLS; if the ERP offers a reliable event feed, replace polling with it. The pilot's job is to turn the assumptions in steps 5 and 6 into measurements.
Common mistakes
- Designing a cloud-hosted integration that calls into the ERP, which needs an inbound path the customer forbids.
- Sending whole records to the cloud and masking later, instead of filtering at the source.
- Retrying forever without a size limit on the buffer, or dropping data silently when it fills.
- Assuming mTLS works through a TLS-inspecting proxy.
- Treating the VPN as reliable and having no reconciliation to prove nothing was lost.
A customer asks whether order placement should call their ERP synchronously, with the user waiting, or go through asynchronous messaging. The UI needs near-real-time feedback, the ERP has occasional latency spikes, and the business needs reliable delivery. Walk through your decision criteria and propose a design.
Sample Answer
The idea in plain words
A synchronous call means the order service sends the request to the ERP (enterprise resource planning system, the back-office system that holds orders, stock and finance) and waits for the answer before replying to the user. Asynchronous messaging means the order service stores the order itself, replies at once that it was received, and passes the order to the ERP later through a queue (a store that holds messages until a consumer takes them). The deciding insight: the user needs fast feedback, not necessarily the ERP's final answer. So accept and record the order locally in the user's request, tell the user it is "received, being confirmed", and finish the ERP step in the background with guaranteed delivery. Make only the cheap checks synchronous.
Decision criteria, in the order I would ask
- Does the user's next step depend on the ERP's answer? If a price or stock figure must come from the ERP to show the page, that read is synchronous (or served from a recent copy). If only the creation of the order needs the ERP, it can wait.
- How bad is a wait or a failure? ERP latency spikes are stated. If the spike exceeds what the user will wait, a synchronous design turns an ERP slowdown into a visible outage.
- How bad is losing or duplicating an order? The business needs reliable delivery, so the order must be stored durably before any reply, and the ERP must not create it twice.
- Can the ERP say no later? (credit hold, invalid item). If yes, the design needs a visible "rejected" status and a way to tell the user.
- How much can the ERP take at once? If it has limited concurrency, a queue protects it.
The design
- The user submits an order. The order service writes the order row with status
pending_erpand, in the same database transaction, a row in an outbox table (a table of messages waiting to be sent, written in the same transaction as the business data so neither can exist without the other). - It replies
202 Accepted(RFC 9110: the request was accepted for processing but processing is not complete) with a status location. Illustrative exchange (not a real capture):
POST /orders HTTP/1.1
Host: shop.example
Content-Type: application/json
Idempotency-Key: 5f1c2a9e-0b7d-4d1e-9a52-3c8e1f0a7b44
{"items":[{"sku":"A-100","qty":2}]}
HTTP/1.1 202 Accepted
Location: /orders/ord_7421
Content-Type: application/json
Content-Length: 40
{"id":"ord_7421","status":"pending_erp"}
Field notes: Idempotency-Key is a client generated unique value so a double click or retry returns the same order (it is a convention used by some APIs and an IETF draft, not a finished standard, so the service defines its behaviour). Location points at where the user interface can poll the order status. The body is 40 bytes, which is the Content-Length.
3. A relay process reads the outbox and publishes each order to the queue. The queue gives at-least-once delivery (a message is never lost but can arrive twice).
4. An ERP adapter takes the message and calls the ERP using the order id as the ERP's external reference. Because of at-least-once delivery, it first checks whether the ERP already has that reference, or uses the ERP's own idempotency feature if it has one, so a repeat does not create a second order.
5. Retries use exponential backoff with jitter (waits that double and are randomised). After a set number of attempts the message goes to a dead-letter queue (a holding area for messages that kept failing), and an alert fires.
6. When the ERP confirms, the adapter updates the order status to confirmed (or rejected with a reason). The user interface sees it by polling /orders/ord_7421 or by a push channel (server-sent events or a websocket), and the customer also gets an email for rejection.
7. Cheap sync checks stay in the request: validate the input, check stock or price against a copy refreshed from the ERP, show its age if it matters.
Worked example (all inputs are assumptions)
Assumptions: peak 5 orders per second; normal ERP latency 0.3 seconds; spike latency 8 seconds for 120 seconds; the user interface gives up at a 3 second timeout; during the spike the ERP can process 2 orders per second; after it recovers it can process 12 orders per second.
Synchronous design during the spike.
- In flight calls (arrival rate x latency, Little's law): normal 5 x 0.3 = 1.5; spike 5 x 8 = 40. A pool of 20 worker threads is exhausted, so even calls to unrelated features queue behind the stuck ones.
- Every order sent during the spike takes 8 seconds, past the 3 second timeout: 5 x 120 = 600 orders show an error. Worse, the outcome is unknown to the caller, because the ERP may still have processed it. A user retry then risks a duplicate unless the ERP call is idempotent.
Asynchronous design during the same spike.
- All 600 orders are accepted in the request and shown as pending. No error is shown.
- Backlog growth during the spike: arrivals 5 per second minus ERP rate 2 per second = 3 per second net, for 120 seconds: 3 x 120 = 360 orders waiting at the end of the spike.
- After recovery, net drain = 12 - 5 = 7 per second, so the backlog clears in 360 / 7 = 51.4 seconds, about 52 seconds.
- User impact: pending for longer for some orders, no failures, no duplicates.
Sizing note: the queue and the status page must be able to hold 360 more rows without trouble; set an alert on queue depth and on the age of the oldest unconfirmed order (for example, page someone if an order is unconfirmed for 15 minutes; the number is a policy choice for the business).
Recommendation
Use the asynchronous design with an outbox and idempotent ERP adapter for order creation, and keep the small synchronous checks. I would choose synchronous only if the ERP is reliably fast, the business cannot accept a pending state, and a failure shown to the user is acceptable. Trade-offs I accept: eventual confirmation (the user sees "pending"), a status channel to build, and more moving parts to monitor (outbox lag, queue depth, dead letters). A middle option is a short synchronous attempt with a timeout (for example 2 seconds) and fallback to the queue when it fails; it improves the median case but still needs all the idempotency and outbox machinery, so it costs more than it saves unless most users want instant confirmation.
Common mistakes
- Publishing to the queue after the database commit as a separate step: a crash in between loses the order.
- Retrying a timed out synchronous call without idempotency.
- Returning
200 OKwith no status, so the user cannot tell pending from done. - Forgetting the rejected path.
- No alert on queue age.
A customer runs an on-prem ERP and wants it integrated with a cloud order-management SaaS. How would you decide how the two systems should exchange data? Lay out the realistic options and compare them on latency, reliability, security, operational overhead, and ease of testing, then say which you would recommend and when you would choose differently.
Sample Answer
The idea in plain words
An on-premises ERP (enterprise resource planning system, the customer's system of record for finance, stock and orders) sits behind the customer's firewall, often on an old release, and is slow to change. A cloud order-management SaaS (software run by a vendor and used over the internet) is reachable from anywhere and changes weekly. Here "idempotent" will matter later: an operation is idempotent if doing it twice leaves the same result as doing it once. The decision is not "which technology" but "which side initiates the connection, what carries the data while the other side is down, and who operates the piece in the middle". Those three answers fix latency, reliability, security, operating effort and how easily you can test.
Method: what I would clarify first, then the options
Questions to the customer before choosing (each changes the answer):
- What interfaces does the ERP offer: web services, a database, message queue, only file exports?
- Which data moves which way (orders into the ERP, stock and shipment status back, product and price data), and how many records per day? For the numbers below I assume 20,000 orders a day and that status must reach the SaaS within 2 minutes. The volume is modest: 20,000/86,400≈0.23 orders per second, or about 20,000/1,440≈14 per minute on average, so even an agent that polls every 30 seconds collects only about 7 orders per poll on average. Volume is not what separates the options here; reliability and security are.
- Will the customer's security team allow any inbound connection to the ERP network? (Most do not.)
- Does the ERP have maintenance windows, and who can change it?
Three realistic options:
Option A: the cloud calls the ERP directly (synchronous API calls over a VPN, a private encrypted network link, or a published endpoint).
Option B: an outbound-only agent on the customer's network plus a cloud queue. A small program (the agent) runs inside the customer network, opens only outgoing TLS connections (TLS is the encryption used by HTTPS) on port 443 (the standard HTTPS port) to the cloud, so the customer's firewall needs no inbound rule (an inbound connection is one started from outside toward the ERP network; an outbound connection is one started from inside), pulls work from a queue (a durable list of messages) and writes to the ERP through its supported interface, and publishes ERP changes back to the cloud.
Option C: scheduled files (the ERP exports and imports files through SFTP, a secure file transfer protocol, every N minutes).
Two variants to know: change data capture (CDC) reads the ERP database's change log and emits each change as an event (fast, but it couples you to the ERP's table layout and usually needs the ERP vendor's agreement), and iPaaS (integration platform as a service, a hosted product with prebuilt connectors) can supply Option B's agent and queue instead of building them.
Comparison on the five requested axes
| Axis | A: direct calls | B: agent and queue | C: files |
|---|---|---|---|
| Latency | lowest, request time only | seconds, plus agent polling interval (how often the agent asks the queue for new work) | one file interval, minutes to hours |
| Reliability when one side is down | poor: orders fail while the ERP or link is down | good: the queue holds messages | good: files wait to be picked up |
| Security | needs an inbound path into the ERP network | outbound-only, no open inbound port | file credentials and files at rest to protect |
| Operational overhead | low (nothing extra to run) but incident-prone | medium: agent updates, queue monitoring | low to medium: file jobs, rejects |
| Ease of testing | medium: needs a live ERP test system | good: replay messages, fake either side | very good: files are plain and diffable |
Worked scoring (an illustration of the method, with assumed weights and my own judgment scores, 1 worst to 5 best; the customer's own weights replace mine). What the scores mean per axis: for reliability, 5 means no order is lost and work simply waits while a side is down, and 2 means orders fail during an outage and the caller must cope; for latency, 5 means the answer comes back within the request and 1 means data waits a whole file interval; for security, 5 means no inbound path into the ERP network, and 3 means a path or stored files that need extra protection; operations and testing follow the same pattern, with 5 meaning least effort or easiest to test. Weights: latency 2, reliability 3, security 3, operations 2, testing 1 (sum 11).
| Option | Latency | Reliability | Security | Operations | Testing | Weighted total |
|---|---|---|---|---|---|---|
| A | 5 | 2 | 3 | 3 | 3 | 2x5 + 3x2 + 3x3 + 2x3 + 1x3 = 10+6+9+6+3 = 34 |
| B | 4 | 5 | 5 | 3 | 4 | 2x4 + 3x5 + 3x5 + 2x3 + 1x4 = 8+15+15+6+4 = 48 |
| C | 1 | 4 | 3 | 4 | 5 | 2x1 + 3x4 + 3x3 + 2x4 + 1x5 = 2+12+9+8+5 = 36 |
Maximum possible is 11 x 5 = 55. The point of the table is not the totals but that it shows which weights drive the result: B wins here because reliability and security carry 6 of the 11 weight points.
Recommendation and what flips it
I would recommend Option B with a nightly reconciliation file (Option C used as a safety net): the agent carries orders into the ERP and status back within seconds, and a nightly comparison of order counts and totals between the two systems catches anything a retry missed. With the assumed numbers, a 30-second agent polling interval adds at most 30 seconds to the 2-minute status target, so it fits.
What would make me choose differently:
- The ERP only produces files and cannot be called: choose C and say so, with a short interval and strict reject handling.
- The customer provides a private network link, an ERP with a modern API, and needs an immediate answer to a question (is this item in stock right now?): add Option A for that one read-only call, still with a timeout and a fallback.
- A very small volume, one customer, no engineering time: use an iPaaS to supply the agent and queue.
- The ERP cannot be touched but its database can be read under agreement: consider CDC for the outbound direction only.
Failure modes to state
- Duplicate delivery after an agent restart: make the ERP write idempotent by carrying the SaaS order number as the ERP's external reference and checking it before insert. One order message, illustratively:
{"saas_order_number": "SO-48213", "customer": "C-7710", "lines": [{"sku": "A-100", "qty": 2}]}. First delivery: the agent searches the ERP for an order whose external reference isSO-48213, finds none, inserts the order and storesSO-48213as its external reference. The agent restarts before it acknowledged the message, so the queue delivers it again: the search now finds the order, the agent skips the insert and acknowledges. The ERP holds one order, not two. - Agent down: alert on queue age (how long the oldest unprocessed message has been waiting), not only on errors.
- Credentials: give the agent a narrowly scoped, rotatable credential and log every write with the order number.
Common mistakes
- Opening an inbound firewall hole "temporarily".
- Choosing by latency alone and ignoring what happens during the ERP's nightly window.
- Writing straight into ERP tables, which bypasses its business rules.
That is every published Enterprise Application Integration question for Systems Engineer so far. Browse the other topics in this category, or practice this one interactively.