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-中文教程
- Easy-to-use quickly develop and setup a network component
- Cross language and platform
- High performance and distributed
- Binary communication protocol
- Support long and short socket connection
- Support multi thread on both client and server side
- Support synchronous or asynchronous method call
- Support compression for big content
- Support Server push message to client
- Can use for cross-language RPC, high performance cache server, distributed message service, MMO game server……
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 TestManager.class and TestManagerImpl.class.
TestManager.java
public interface TestManager {
public String sayHello(int Id, String name);
}
TestManagerImpl.java
public class TestManagerImpl implements TestManager{
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. TestServer.java
public class TestServer {
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 TestManager manager;
public static void main(String[] args) {
transferObjectFactory = new TransferObjectFactory("test1", true);
transferObjectFactory.setImplClass("TestManagerImpl");
manager = (TestManager)ClientProxyFactory.create(TestManager.class, transferObjectFactory);
int Id = 18;
String name = "JimT";
String result = manager.sayHello(Id, name);
System.out.println("result: "+result);
}
}
Of cause, we need have that interface class (TestManager.class) and put into classpath. And need have a controller.xml as well, that indicates what IP, port and name client want to communicate. (Notice the connection name “test1”) controller.xml
<connections>
<connection>
<hostIp>127.0.0.1</hostIp>
<hostPort>10001</hostPort>
<timeout>5000</timeout>
<retryTime>3</retryTime>
<name>test1</name>
</connection>
</connections>
That is everything from server to client codes and configuration for a full RPC. It is very 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 |
WrapperClass | Y | Y |
Require JDK1.7, because using Java AIO.
Third part libs include XSteam and Log4j.
This library is distributed under Apache License Version 2.0
QQ: 37287685