Java Fat Free Remoting
Java Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
gradle/wrapper
resources
src
.gitattributes
.gitignore
.travis.yml
LICENSE.md
README.md
build.gradle
gradlew
gradlew.bat
pom.xml
settings.gradle

README.md

jaffre - Java Fat Free Remoting

Build Status

Introduction

Jaffre is a lightweight RPC library for the Java platform. It is designed to be simple, extensible, robust, and efficient. Currently it supports transport over insecure or TLS encrypted TCP channels. It supports sessions and can be customized so that calls are performed as a particular session dependent subject.

Usage

Implementing a service is as simple as defining a service interface, implementing it in a pojo, and registering that pojo as a service endpoint. The service is exposed to clients through one or more connectors. Clients call the service through proxy classes.

public interface Remote
{
  public String logAndEcho(String msg);
}

// Server
void runTheServer()
{
  // register a service endpoint
  final JaffreServer server = new DefaultJaffreServer();

  server.registerInterface(new RemoteImpl());

  // start the socket connector
  final SocketJaffreConnector connector = new SocketJaffreConnector();

  connector.setServer(server);
  connector.setBindingAddress("localhost");
  connector.setPort(4711);
  connector.setCoreThreadPoolSize(3);

  connector.start();

  synchronized (this)
  {
    wait(); // until we're done
  }

  connector.stop();
}

// Client
void runTheClient() throws Exception
{
  // create a socket client
  final SocketJaffreClient client = new SocketJaffreClient();

  client.setServiceAddress("localhost");
  client.setServicePort(4711);

  // create a proxy for the remote interface
  final Remote proxy = client.getProxy(Remote.class);

  proxy.logAndEcho("This is a remote call.");

  // done
  client.dispose();
}

For code examples see the samples directory. The JavaDocs can be found here.

Dependencies

Jaffre does not have any required dependencies.