Skip to content

An easy-to-use RPC middleware, cross language and platform. Right now, there are Java and C# client available.

License

Notifications You must be signed in to change notification settings

iamzhongyong/Tatala

 
 

Repository files navigation

TATALA

Overview

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-中文教程

Features

  • 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……

Get Started

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-中文教程

Support Type

Supported parameter and return type table

TypeJavaC#
boolYY
byteYY
shortYY
chatYY
intYY
longYY
floatYY
doubleYY
DateYY
StringYY
byte[]YY
int[]YY
long[]YY
float[]YY
double[]YY
String[]YY
SerializableYN
WrapperClassYY

Other Notes

Require JDK1.7, because using Java AIO.

Third part libs include XSteam and Log4j.

License

This library is distributed under Apache License Version 2.0

Contact

jimtang@hotmail.ca

QQ: 37287685

About

An easy-to-use RPC middleware, cross language and platform. Right now, there are Java and C# client available.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published