当前位置: 首页 > news >正文

netty代理转发_lemon: 基于Netty的微服务网关,实现Dubbo、HTTP等代理转发!

lemon

The Micro Service Gateway Framework.

Lemon is a high-performance, Java based open source gateway framework.

基于Netty4的微服务网关(Micro Service Gateway)。同时支持Dubbo泛化调用和HTTP调用,并支持自定义实现微服务网关请求的代理转发功能。

QQ交流群:微服务基础架构(191958521)

微信交流:请加echo-lry

Architecture

9b3b2bb422718c3335e536e02cf34e7e.png

Features

HTTP to Dubbo Gateway

HTTP to HTTP Gateway

High Performance

Dynamic Discovery

Generalized Agent

Extensible Chain of Responsibility

Two-way LOG Printing Filter

TODO

HTTP proxy Motan

HTTP proxy SpringCloud

TCP proxy other

CircuitBreaker Filter

Degrade Filter

Idempotent Filter

Limiter Filter

Retry Filter

Config Introduce

Config Path: src/main/resources/lemon.yml

port: 8080

application: lemon

# Netty IO/Work thread number

ioThread: 0

workThread: 0

# Body max content length, 64 * 1024 * 1024 = 64 MB

maxContentLength: 67108864

# Max client connection channel number

maxChannel: 100000

#

bizCoreThread: 20

bizMaxThread: 200

bizQueueCapacity: 800

bizKeepAliveTime: 60000

# Custom Fixed Response Header Parameter Configuration

resHeaders:

Connection: keep-alive

Accept-Encoding: gzip,deflate

Content-Type: application/json;charset=UTF-8

originalHeaders: [Connection, Content-Type, Set-Cookie, Call-Code, Call-Message]

# Dubbo lemon config

dubbo:

registryAddress: zookeeper://127.0.0.1:2181

metadataAddress: zookeeper://127.0.0.1:2181

# Direct forwarding HTTP rule

services:

- category: jsoup

service: /baidu/**

url: https://www.baidu.com

- category: jsoup

service: /oschina/**

url: https://www.oschina.net

Dubbo Lemon

The support apache dubbo 2.7.2 generic service proxy.

Format:

URL:

http://[host]:[port]/lemon/[application]/[service or serviceSimpleName]/[method]?group=[group]&version=[version]

Body:

List[Map{...}, Map{...}, ...]

Example:

http://localhost:8080/lemon/micro-dubbo-provider/cn.micro.biz.dubbo.provider.DemoService/test

or

http://localhost:8080/lemon/micro-dubbo-provider/demo/test

[{"name":"lemon", "age":23}, {"10001"}]

HTTP Lemon

Proxy forwarding using jsoup.

http://[host]:[port]/lemon/[service]/**?group=[group]&version=[version]

Motan Lemon

TODO

Spring Cloud Lemon

TODO

Packing and Installation

mvn clean install -Denforcer.skip=true -Dmaven.test.skip=true

The target directory: target/lemon-1.0.0-SNAPSHOT-dist.tar.gz

After successful execution, lemon-1.0.0-SNAPSHOT-dist.tar.gz will be generated in the directory of target.

Start lemon

> tar -zxvf lemon-1.0.0-SNAPSHOT-dist.tar.gz

> cd bin

> ./app start

# Usage: app { console | start | stop | restart | status | dump }

Use Arthas

Alibaba Arthas

arthas-boot:

> wget https://alibaba.github.io/arthas/arthas-boot.jar

> java -jar arthas-boot.jar

as.sh:

> curl -L https://alibaba.github.io/arthas/install.sh | sh

> ./as.sh

Start service provider

The metadata report config must be used.

import DemoService;

import DemoServiceImpl;

import org.apache.dubbo.config.*;

public class ProviderDemo {

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

// Implementation

DemoService demoService = new DemoServiceImpl();

// Application Info

ApplicationConfig application = new ApplicationConfig();

application.setName("micro-dubbo-provider");

// Registry Info

RegistryConfig registry = new RegistryConfig();

registry.setAddress("zookeeper://127.0.0.1:2181");

// Metadata Report Info

MetadataReportConfig metadataReportConfig = new MetadataReportConfig();

metadataReportConfig.setAddress("zookeeper://127.0.0.1:2181");

// Protocol

ProtocolConfig protocol = new ProtocolConfig();

protocol.setName("dubbo");

protocol.setPort(12345);

protocol.setThreads(200);

// Exporting: In case of memory leak, please cache.

ServiceConfig service = new ServiceConfig<>();

service.setApplication(application);

// Use setRegistries() for multi-registry case

service.setRegistry(registry);

// Use setProtocols() for multi-protocol case

service.setProtocol(protocol);

service.setMetadataReportConfig(metadataReportConfig);

service.setInterface(DemoService.class);

service.setRef(demoService);

// Local export and register

service.export();

System.in.read();

}

}

License

Lemon is under the MIT license. See the LICENSE file for details.

相关文章:

  • mysql自动备份快结束很卡_mysql备份慢以及自动重启问题——调整NUMA
  • mysql 数据库表属性默认_【学习之Mysql数据库】mysql数据库创建表的属性详解
  • perl mysql utf8_mysql – Perl字符串操作和utf8 / unicode
  • docker redis mysql_Docker安装常用组件(mysql,redis)的方法
  • mysql 检查约束 替代_MySQL检查约束
  • mysql触发器修改表分区_MySQL 触发器例子(两张表同步增加和删除)
  • mysql索引性能极具下降_性能优化之mysql索引优化
  • mysql keepalived6_MySQL+Keepalived实现主主高可用方案
  • python install package_python install package作为另一个包的子包
  • 易语言 excel_易语言初级教程-将图片转化为excel像素画
  • PHP启动mysql时出现路径_MySQL数据库改路径后没办法启动的问题
  • es6 三点运算符_ES6-- 扩展运算符与剩余操作符...
  • mysql teaching_php同步mysql两个数据库中表的数据
  • windows 命令行远程连接_Linux下远程连接Windows桌面
  • 数据库逻辑设计mysql_数据库设计(一)分析及逻辑设计
  • 【comparator, comparable】小总结
  • 【剑指offer】让抽象问题具体化
  • github从入门到放弃(1)
  • javascript从右向左截取指定位数字符的3种方法
  • JavaScript类型识别
  • Js实现点击查看全文(类似今日头条、知乎日报效果)
  • node 版本过低
  • SegmentFault 2015 Top Rank
  • 反思总结然后整装待发
  • 分布式任务队列Celery
  • 使用 @font-face
  • 思维导图—你不知道的JavaScript中卷
  • 原生js练习题---第五课
  • 在Unity中实现一个简单的消息管理器
  • 昨天1024程序员节,我故意写了个死循环~
  • ​ 无限可能性的探索:Amazon Lightsail轻量应用服务器引领数字化时代创新发展
  • ​520就是要宠粉,你的心头书我买单
  • ​HTTP与HTTPS:网络通信的安全卫士
  • ​Python 3 新特性:类型注解
  • # Maven错误Error executing Maven
  • #NOIP 2014# day.1 生活大爆炸版 石头剪刀布
  • #我与Java虚拟机的故事#连载05:Java虚拟机的修炼之道
  • (+4)2.2UML建模图
  • (2)STL算法之元素计数
  • (33)STM32——485实验笔记
  • (java)关于Thread的挂起和恢复
  • (附源码)python旅游推荐系统 毕业设计 250623
  • (附源码)ssm基于web技术的医务志愿者管理系统 毕业设计 100910
  • (附源码)ssm智慧社区管理系统 毕业设计 101635
  • (完整代码)R语言中利用SVM-RFE机器学习算法筛选关键因子
  • (一)搭建springboot+vue前后端分离项目--前端vue搭建
  • .bashrc在哪里,alias妙用
  • .NET C#版本和.NET版本以及VS版本的对应关系
  • .Net Core和.Net Standard直观理解
  • .Net Redis的秒杀Dome和异步执行
  • .net中我喜欢的两种验证码
  • //解决validator验证插件多个name相同只验证第一的问题
  • @Autowired @Resource @Qualifier的区别
  • @modelattribute注解用postman测试怎么传参_接口测试之问题挖掘
  • @拔赤:Web前端开发十日谈