Java library for making distributed remote procedure calls really easy.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Hileco DRPC

This project is no longer maintained and part of my source code "attic". This project's code is not fully functional - please use MQTT-DRPC instead.

This library lets you make distributed remote procedure calls and get results back, with plain Java.

  • Requires Java 8.
  • RPC go over HTTP, using Apache HTTPClient and an embedded Grizzly Server.
  • RPC content is JSON, written and read streaming, metadata is in HTTP headers.
  • You can publish and consume standard java interfaces.
  • Builds with maven.


SubscriptionStore subscriptionStore = new CacheSubscriptionStore();
RouterServer routerServer = new RouterServer(subscriptionStore);

This starts a message router on port 8080, using an in-memory store of subscriptions. Subscriptions contain only a topic, an address, and a unique identifier.


Define the interface of your service(s)

public interface CalculatorService {

    public Integer calculate(Integer a, Integer b);


Instantiate a client, client to router communication is two way.

Client client = new Client(routerURL, localHostname, localPort);

Notify the router we have a CalculatorService that other clients can talk to.

client.publish(CalculatorService.class, // functionality to expose
               "remote-calculator",     // service identifier for rpc
               (a, b) -> a + b);        // implementation of our service


Instantiate a client, client to router communication is two way. Create a service connector using the new client.

Client client = new Client(routerURL, localHostname, localPort);
ServiceConnector<CalculatorService> connector = client.connector(CalculatorService.class);

With the connector we can make distributed calls, with regular interfaces, and nice Java 8 syntax to go along with it. This example will call every CalculatorService ( registered as described earlier ), and then logs any results it gets.

connector.drpc(d -> d.calculate(1, 2),
               r ->"CalculatorService#calculate(1,2) = {}", r));

And targeted calls.

CalculatorService remoteCalculator = connector.connect("remote-calculator"); // connect to the calculator identified by the id we've registered with at the service-side