call(back)

Design an RPC Layer Over Hand-Written REST Calls

A codebase calls its internal services through hand-written REST calls: URLs built by string concatenation, JSON assembled by hand, retries copied and pasted. Design an RPC abstraction layer to replace them.

Cover the interface definition and what is generated from it, marshalling, service discovery, deadlines, retries and their relationship with idempotency, and how interfaces evolve without breaking callers.

Hints

Hint 1

An interface definition generates client stubs and server skeletons, so the wire format, discovery and retry logic live in one place and callers write a method call.

Hint 2

Retry only idempotent calls, and give every request an id so a server can filter duplicates of the non-idempotent ones.

Hint 3

Versioning: additive changes to messages with defaults for new fields; a new method or a new version for anything else.

Asked at