GithubHelp home page GithubHelp logo

hetty's Introduction

Hetty

Hetty是一款构建于Netty和Hessian基础上的高性能的RPC框架.Hessian是一款基于HTTP协议的RPC框架,采用的是二进制RPC协议,非常轻量级 ,且速度较快。Netty是一款基于事件驱动的NIO框架,用以快速开发高性能、高可靠性的网络服务器和客户端程序。Hetty客户端完全由 Hessian实现,只是使用Netty重新实现了服务端。 使用方法:

1.配置Hetty服务器。

server.devmod=false #配置开发模式 server.key=server1 #配置服务器Key,用于认证 server.secret=server1 #配置服务器secret,用于认证 server.port=8081 #配置端口号

server.thread.corePoolSize=4 #线程池配置 server.thread.maxPoolSize=100 server.thread.keepAliveTime=3000 server.method.timeout=3000 properties.file=config.xml #配置service定义文件

2.service配置

<services>
	<service name="basic" interface="test.BasicAPI">
		<provider version="1" class="test.BasicService" default="true" />
	</service>
	<service name="hello" interface="test.example.Hello" overload="true">
		<provider version="2" class="test.example.Hello2Impl"/>
	</service>
</services>

配置包括三部分,第一部分applications,配置客户端的user和密码,来做权限认证。第二部分配置service接口,比如: 我们配置了test.BasicAPI接口,接口名字为basic,有一个版本,版本号为1,且为默认版本。 第三部分配置客户端的调用的版本,比如可以配置client1调用basic接口的1版本。

3.客户端调用

public static void main(String[] args) throws MalformedURLException {

	String url = "http://localhost:8081/apis/hello/";

	HessianProxyFactory factory = new HessianProxyFactory();

	factory.setUser("server1");

	factory.setPassword("server1");

	factory.setOverloadEnabled(true);

	final Hello basic = (Hello) factory.create(Hello.class, url);
	
	System.out.println(basic.hello());
	System.out.println(basic.hello("guolei"));
	System.out.println(basic.hello("guolei","hetty"));
}

hetty's People

Contributors

xishuixixia avatar

Watchers

James Cloos avatar Gavin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.