Skip to content
Permalink
Browse files
refactor: switch from reactor-netty to netty, and support fetching va…
…r and body (#100)
  • Loading branch information
tzssangglass committed Dec 30, 2021
1 parent 4e3279f commit f0ef4b7758188ccae3bcf35a6b95f2459180f3c9
Showing 43 changed files with 1,026 additions and 721 deletions.
@@ -32,9 +32,10 @@ jobs:
fail-fast: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
- uses: actions/setup-java@v2
with:
java-version: 8
distribution: 'zulu'
java-version: '11'
- name: Check License Header
uses: apache/skywalking-eyes@main
env:
@@ -49,8 +50,9 @@ jobs:
fail-fast: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
- uses: actions/setup-java@v2
with:
java-version: 8
distribution: 'zulu'
java-version: '11'
- name: 'Install & Test'
run: ./mvnw clean install
@@ -28,8 +28,8 @@ This document explains how to get started to develop the apisix-java-plugin-runn
Prerequisites
-------------

* JDK 8
* APISIX 2.7.0
* JDK 11
* APISIX 2.10.x
* Clone the [apisix-java-plugin-runner](https://github.com/apache/apisix-java-plugin-runner) project.
* Refer to [Debug](how-it-works.md#debug) to build the debug environment.

@@ -33,7 +33,7 @@ This article explains the internal design of apisix-java-plugin-runner.

## Overview

The apisix-java-plugin-runner designed as a TCP server built using [reactor-netty](https://github.com/reactor/reactor-netty),
The apisix-java-plugin-runner designed as a TCP server built using [netty](https://github.com/netty/netty),
it provides a `PluginFilter` interface for users to implement.

Users only need to focus on their business logic, not on the details of how the apisix java plugin runner communicates with APISIX.
@@ -56,7 +56,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compiler.version>1.8</compiler.version>
<compiler.version>11</compiler.version>
<netty.version>4.1.54.Final</netty.version>
<guava.version>30.1.1-jre</guava.version>
<spring-boot.version>2.4.5</spring-boot.version>
@@ -106,8 +106,10 @@
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<release>${compiler.version}</release>
<source>${compiler.version}</source>
<target>${compiler.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
@@ -17,7 +17,8 @@
~
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
@@ -55,20 +56,16 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
<exclusions>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-reactor-netty</artifactId>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
</dependency>
<dependency>
<groupId>io.netty</groupId>
@@ -80,11 +77,6 @@
<artifactId>netty-transport-native-epoll</artifactId>
<classifier>linux-aarch_64</classifier>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
@@ -102,11 +94,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>

This file was deleted.

@@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.apisix.plugin.runner.service;
package org.apache.apisix.plugin.runner.configuration;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
@@ -27,8 +27,7 @@
import java.util.concurrent.TimeUnit;

@Configuration
public class CacheConfiguration {

public class A6HandlerConfiguration {
@Bean
public Cache<Long, A6Conf> configurationCache(@Value("${cache.config.expired:3610}") long expired,
@Value("${cache.config.capacity:1000}") int capacity) {
@@ -15,14 +15,15 @@
* limitations under the License.
*/

package org.apache.apisix.plugin.runner.codec;
package org.apache.apisix.plugin.runner.constants;

import org.apache.apisix.plugin.runner.A6Request;
public class Constants {

import java.nio.ByteBuffer;
public static final byte RPC_ERROR = 0;

@FunctionalInterface
public interface PluginRunnerDecoder {
public static final byte RPC_PREPARE_CONF = 1;

A6Request decode(ByteBuffer buffer);
public static final byte RPC_HTTP_REQ_CALL = 2;

public static final byte RPC_EXTRA_INFO = 3;
}

This file was deleted.

This file was deleted.

@@ -15,13 +15,13 @@
* limitations under the License.
*/

package org.apache.apisix.plugin.runner.codec;
package org.apache.apisix.plugin.runner.handler;

import io.netty.handler.codec.LengthFieldBasedFrameDecoder;

public class DelayedDecoder extends LengthFieldBasedFrameDecoder {
public class BinaryProtocolDecoder extends LengthFieldBasedFrameDecoder {

public DelayedDecoder() {
public BinaryProtocolDecoder() {
super(16777215, 1, 3, 0, 0);
}
}

This file was deleted.

0 comments on commit f0ef4b7

Please sign in to comment.