EasyRPC Framework Overview: Architecture, Server Publishing, and Client Invocation
This article introduces the EasyRPC framework, explaining its RPC fundamentals, the use of Netty for communication, Spring for configuration, dynamic proxy for transparent calls, Protostuff for message serialization, and details both server-side service publishing and client-side invocation with reconnection handling.
Remote Procedure Call (RPC) allows invoking services on a remote machine as if they were local, and it helps decouple systems; WebService is an example of an HTTP‑based RPC.
EasyRPC addresses several technical challenges: it uses Netty for communication, Spring for service configuration and bean loading, dynamic proxy on the client side for transparent service calls, and Protostuff for message serialization and deserialization.
Server side publishing includes defining a service interface and its implementation, configuring spring-server.xml , loading custom beans via Spring at startup, exporting the Netty server, and registering the service.
Client side invocation involves configuring spring-client.xml , using a proxy to call the remote service, setting a timeout on RpcFuture to avoid hangs, injecting the service bean through ConsumerFactoryBean , starting the client with refer , and handling automatic reconnection by listening to connectFuture.channel().closeFuture .
Protostuff is employed to implement serialization and deserialization utilities, and a TCP handler deals with message framing by prefixing each message with a 4‑byte length field.
JD Tech
Official JD technology sharing platform. All the cutting‑edge JD tech, innovative insights, and open‑source solutions you’re looking for, all in one place.
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.