An easy-to-use RPC middleware, cross language and platform. Right now, there are Java and C# client available.
Version 0.3.0
Release Note: https://github.com/zijan/Tatala-RPC/wiki
Tatala is an easy-to-use RPC middleware, cross language and cross platform, that convert method signature (include callee class name, target method name, the number of its arguments and server return) into byte array, communicate with client and server base on socket.
Right now, there are Tatala-Java (client & server) and Tatala-client-csharp available.
https://github.com/zijan/Tatala/wiki/Tatala-中文教程
https://repo1.maven.org/maven2/com/github/zijan/tatala/
<dependency>
<groupId>com.github.zijan</groupId>
<artifactId>tatala</artifactId>
<version>0.3.0</version>
</dependency>
Download tatala.jar from repository. If you're using ant, change your build.xml to include tatala.jar. If you're using eclipse, add the jar to your project build path.
As you known, easy-to-use is the first consideration among Tatala features. It can make developer create RPC just like local method call. They don’t have to care about socket or thread all kind stuff.
For example, we have server logic ExampleManager.class and ExampleManagerImpl.class.
ExampleManager.java
public interface ExampleManager {
public String sayHello(int Id, String name);
}
ExampleManagerImpl.java
public class ExampleManagerImpl implements ExampleManager{
public String sayHello(int Id, String name) {
return "["+Id+"]"+"Hello "+name+" !";
}
}
We need to create a socket server class, in order to deploy our server logic on server side. In this sample, socket server listener port is 10001.
ExampleServer.java
public class ExampleServer {
public static void main(String args[]) {
int listenPort = 10001;
int poolSize = 10;
AioSocketServer server = new AioSocketServer(listenPort, poolSize);
server.start();
}
}
Then client side code is something like:
EasyClient.java
public class EasyClient {
private static TransferObjectFactory transferObjectFactory;
private static ExampleManager manager;
public static void main(String[] args) {
transferObjectFactory = new TransferObjectFactory("127.0.0.1", 10001, 5000);
transferObjectFactory.setImplClass(ExampleManagerImpl.class);
manager = (ExampleManager)ClientProxyFactory.create(ExampleManager.class, transferObjectFactory);
String result = manager.sayHello(18, "JimT");
System.out.println("result: "+result);
}
}
Create TransferObjectFactory object with server ip, port ant timeout, and set implement class. Create a proxy, make method call. Of cause, client side need have that interface class (ExampleManager.class) in classpath.
That is everything from server to client. Don't have any configuration files. It is so simple, right?
There are more examples on tutorial section.
https://github.com/zijan/Tatala/wiki/Tatala-Tutorial#tutorial
https://github.com/zijan/Tatala/wiki/Tatala-中文教程
Supported parameter and return type table
Type | Java | C# |
bool | Y | Y |
byte | Y | Y |
short | Y | Y |
chat | Y | Y |
int | Y | Y |
long | Y | Y |
float | Y | Y |
double | Y | Y |
Date | Y | Y |
String | Y | Y |
byte[] | Y | Y |
int[] | Y | Y |
long[] | Y | Y |
float[] | Y | Y |
double[] | Y | Y |
String[] | Y | Y |
Serializable | Y | N |
Protobuf | Y | Y |
WrapperClass | Y | Y |
Require JDK1.7, because using Java AIO.
Third part libs include Protobuf and Log4j.
This library is distributed under Apache License Version 2.0
QQ: 37287685