Overview of Service Communication: Synchronous, Asynchronous, RPC, REST, Service Discovery, and Messaging
This article explains internal service communication patterns, covering request/response and asynchronous messaging, their implementations, message formats, RPC and REST principles, service discovery methods, channel types, and key considerations for choosing a message‑queue component.
Overview
Internal service communication can be divided into two categories: request/response (e.g., REST, gRPC) and asynchronous messaging (e.g., AMQP, STOMP).
Communication Types
Two dimensions: 1‑to‑1 vs 1‑to‑many, and synchronous vs asynchronous.
1‑to‑1 implementations
Request/response communication
Asynchronous request/response
One‑way notification
1‑to‑many implementations
Publish/subscribe
Publish/async response
Message Formats
Messages are either text (JSON, XML) or binary (Avro, Protobuf, Thrift). Language‑agnostic formats are preferred over Java serialization.
RPC
Remote Procedure Call allows a client to invoke a remote service as if it were a local method. The provider’s proxy sends data over the network, the server processes the request, and the result is returned to the client.
REST
REST is a set of architectural constraints, typically using HTTP. Resources represent business entities such as users or orders. Common HTTP methods include POST /user (create), PUT /user (update), GET /users (list), and GET /user/{id} (retrieve).
Service Discovery
Two approaches: static discovery (fixed addresses) and dynamic discovery (service registry or platforms like Kubernetes). Dynamic discovery involves service registration and retrieval from a registry.
Asynchronous Messaging
Message‑oriented applications use a message broker as an intermediary. A sender publishes messages to a channel, and consumers read from the channel. Messages consist of a header (key‑value pairs, including a unique ID) and a body. Types include Document, Command, and Event.
Channels
Channels enable message exchange and come in two forms: point‑to‑point and publish/subscribe.
Implementation Considerations for Asynchronous Messaging
When selecting a message‑queue component, consider supported programming languages, message standards, ordering guarantees, delivery mechanisms, persistence, scalability, and timeliness.
IT Architects Alliance
Discussion and exchange on system, internet, large‑scale distributed, high‑availability, and high‑performance architectures, as well as big data, machine learning, AI, and architecture adjustments with internet technologies. Includes real‑world large‑scale architecture case studies. Open to architects who have ideas and enjoy sharing.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.