REST, RPC, and Brokered Messaging

This article explores three popular styles of communication in service-oriented architectures and how to chose the appropriate style for a given use case.

Nathan Murthy
Dec 4, 2017 · 14 min read
Image for post
Image for post


Representational State Transfer

HTTP request                           Method name
--------------------------------- -------------
POST CreateObject
GET ReadObject
PUT UpdateObject
DELETE DeleteObject

Remote Procedure Call

// Redis protocol as RPC interface for caches 
// We can think of Set() and Get() as RPC calls
err := cache.Set(key,value).Err()
val, err := cache.Get(key).Result()
// JDBC protocol as RPC interface for databases 
// We can think of executeQuery() as a RPC call
Statement stmt = dbConn.createStatement();
ResultSet rs = stmt.executeQuery(sql);
Service A  <=>  Service B  <=>  Service C  <=>  Service D
Image for post
Image for post
Observing RPC calls traced in a large distributed system (

Brokered Messaging

Image for post
Image for post
The basic Message Broker pattern (source:


Image for post
Image for post
REST, RPC, and Message Brokering working together in a distributed system. In this diagram REST services most browser-based UI interactions, particularly over public networks. RPC makes up the majority of inter-service communication as well as a few UI requests. And messages are brokered across services and data stores that rely on pubsub streaming. Each component satisfies a domain and communicates with other components using a domain-specific semantics.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store