Skip to content
Ignacio del Valle Alles edited this page Nov 17, 2016 · 26 revisions

Brutusin-RPC

Brutusin-RPC is an open-source Java framework for creating self-descriptive JSON-RPC microservices and single-page applications (SPA) with minimal effort.

Components

  • JSON-RPC services (over HTTP or websockets)
  • Messaging topics for server to client notifications (over websockets)

Built for Productivity

Just code it (strategy pattern):

@Description("A demo greeting service")
public class HelloAction extends WebsocketAction<String, String> {
    @Override
    public String execute(String input) throws Exception {
        return "Hello " + input + "!";
    }    
}

... run it (embedded Tomcat runtimes 8 provided):

public static void main(String[] args) throws Exception {
    Server.test(new HelloAction());
}

... test it (functional test module provided):

... then integrate it into the application (Spring IoC):

<bean id="wsk.hello" class="org.brutusin.demo.HelloAction"/>

... and use it client-side (javascript client API provided):

wsk.exec({
    service: "wsk.hello",
    input: "world!",
    load: function (response) {alert(response.result);}
});

Built for Maintainability

One of its main goals is maintainability.

  • Builtin services. Descriptive API
  • Builtin functional testing and repository module.
  • Built over Spring IoC
  • Artifact documentation

HTTP aware

It makes the developer aware of several HTTP considerations that are often neglected, like caching, safety and idempotence, with important consequences in performance and reliability.

The framework also, transparently handles and takes advantage of other HTTP features, like response status codes, cache validation and multipart requests processing.

Oriented to "The twelve-factor app" methodology

  • Applications can be deployed in any JEE web container (Servlet 3.0, Websocket 1.1) or run as standalone applications with the embedded Tomcat 8 runtimes.
  • All configuration is done via environment variables.
  • In standalone mode, logs are written to the standard streams.

Why JSON-RPC and not REST?

REST is often compared with RPC, but the truth is they are not comparable entities. In the most common meaning REST is a concrete architectural style bound to the HTTP protocol, whereas RPC is a generic abstract protocol whose only contract is to perform remote method invocations.

This framework uses JSON-RPC over two different transports: HTTP and websockets. The first of them fully exploits the HTTP specific semantics for caching, safety, idempotence, cache validation, and the second is targeted at scenarios demanding high frequency calls.

The big advantage of this framework over REST-based solutions is that, making (transparent) use of JSON Schema, the framework provides builtin services that describe other's input and output messages, letting an arbitrary complexity in the message structure without compromising usability and allowing client automatization.

Live demo

http://demo.rpc.brutusin.org