Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions docs/zh/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,10 @@ public class CheckTokenFilter implements PluginFilter {
}

@Override
public Mono<Void> filter(HttpRequest request, HttpResponse response, PluginFilterChain chain) {
public void filter(HttpRequest request, HttpResponse response, PluginFilterChain chain) {
/*
* todo your business here
*/


return chain.filter(request, response);
}
}
```
Expand All @@ -48,18 +45,17 @@ apisix-java-plugin-runner 与 APISIX 用 `Unix Domain Socket` 进行进程间通
构建完成,你会在 `dist` 目录看见构建产物

```
apache-apisix-java-plugin-runner-0.1.0-bin.tar.gz
apache-apisix-java-plugin-runner-${your_plugin_version}-bin.tar.gz
```

在`dist`目录添加`Dockerfile`文件

```dockerfile
FROM apache/apisix:${version}-alpine

RUN sed -i "s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g" /etc/apk/repositories && apk add --no-cache openjdk8-jre
FROM apache/apisix:${version}-debian

ADD apache-apisix-java-plugin-runner-0.1.0-bin.tar.gz /usr/local/
RUN apt -y install openjdk-11-jdk
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we use the base image with jdk 11?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use the image of apisix , and jdk should in the same image. If i use the base image with jdk , I have to install apisix .


ADD apache-apisix-java-plugin-runner-${your_plugin_version}-SNAPSHOT-bin.tar.gz /usr/local/
```

然后构建容器镜像
Expand All @@ -73,11 +69,20 @@ ADD apache-apisix-java-plugin-runner-0.1.0-bin.tar.gz /usr/local/

```yaml
ext-plugin:
cmd: ['java', '-jar', '-Xmx4g', '-Xms4g', '/path/to/apisix-runner-bin/apisix-java-plugin-runner.jar']
cmd: ['java', '-jar', '-Xmx4g', '-Xms4g', '/usr/local/apisix-runner-bin/apisix-java-plugin-runner.jar']
```

构建完成的 `apache/apisix:${version}-alpine-with-java-plugin` 镜像内即包含 APISIX 与 apisix-java-plugun-runner。

### 调试
如果需要调试插件, 可以将上述 ext-plugin 配置中添加调试参数:
```yaml
ext-plugin:
cmd: ['java', '-jar', '-Xmx4g', '-Xms4g','-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005', '/usr/local/apisix-runner-bin/apisix-java-plugin-runner.jar']
```

就可以通过 Docker 的 5005 端口远程调试插件。

### 使用插件

配置路由
Expand Down