jboot是一个基于jfinal、undertow开发的一个类似springboot的开源框架, 我们已经在正式的商业上线项目中使用。她集成了微服务,MQ,RPC,监控(使用了Hystrix和 Metrics)、访问隔离、容错隔离、延迟隔离、 熔断、代码生成等功能,开发者使用及其简单,同时保证分布系统的高效和稳定。
源码地址:http://git.oschina.net/fuhai/jboot
QQ交流群: 601440615
jboot demo
https://github.com/yangfuhai/jbootdemo
maven dependency
<dependency> <groupId>io.jboot</groupId> <artifactId>jboot</artifactId> <version>1.0-alpha3.1</version></dependency>
controller example
new a controller
@RequestMapping("/")public class MyController extend JbootController{
public void index(){
renderText("hello jboot");
}}start
public class MyStarter{
public static void main(String [] args){
Jboot.run(args);
}}visit: http://127.0.0.1:8080
mq example
config jboot.properties
#type default redis (support: redis,activemq,rabbitmq,hornetq,aliyunmq ) jboot.mq.type = redis jboot.mq.redis.address = 127.0.0.1 jboot.mq.redis.password = jboot.mq.redis.database =
server a sendMqMessage
Jboot.getMq().publish(yourObject, toChannel);
server b message listener
Jboot.getMq().addMessageListener(new JbootmqMessageListener(){
@Override
public void onMessage(String channel, Object obj) {
System.out.println(obj);
}}, channel);rpc example
type default motan (support:local,motan,grpc,thrift) jboot.rpc.type = motanjboot.rpc.requestTimeOut jboot.rpc.defaultPortjboot.rpc.defaultGroup jboot.rpc.defaultVersionjboot.rpc.registryType = consul jboot.rpc.registryName jboot.rpc.registryAddress = 127.0.0.1:8500
define interface
public interface HelloService {
public String hello(String name);}server a export serviceImpl
@JbootrpcServicepublic class myHelloServiceImpl implements HelloService {
public String hello(String name){
System.out.println("hello" + name);
return "hello ok";
}}download consul and start (consul:https://www.consul.io/)
consul -agent dev
server b call
HelloService service = Jboot.service(HelloService.class);
service.hello("michael");or server b controller
public class MyController extends bootController{
@JbootrpcService
HelloService service ;
public void index(){
renderText("hello " + service.hello());
}}其他请点击开源中国查看
start app
cd yourProjectPath/target/app/bin./jboot
start app and change config
cd yourProjectPath/target/app/bin./jboot --jboot.server.port=8080 --jboot.rpc.type=local
use your properties replace jboot.properties
cd yourProjectPath/target/app/bin./jboot --jboot.model=dev --jboot.server.port=8080
use jboot-dev.proerties replace jboot.properties and set jboot.server.port=8080
thanks
rpc framework:
· motan(https://github.com/weibocom/motan)
· grpc(http://grpc.io)
· thrift(https://github.com/apache/thrift)
mq framework:
· activemq
· rabbitmq
· redis mq
· hornetq
· aliyun mq
cache framework
· ehcache
· redis
core framework:
· jfinal (https://github.com/jfinal/jfinal)
· undertow (https://github.com/undertow-io/undertow)
· guice (https://github.com/google/guice)
· metrics (https://github.com/dropwizard/metrics)
· hystrix (https://github.com/Netflix/Hystrix)
author
· name:michael yang
· qq:1506615067
· email:fuhai999@gmail.com