You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by tz...@apache.org on 2022/11/09 06:58:36 UTC

[apisix-java-plugin-runner] branch main updated: docs: improve quick start document (#213)

This is an automated email from the ASF dual-hosted git repository.

tzssangglass pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/apisix-java-plugin-runner.git


The following commit(s) were added to refs/heads/main by this push:
     new 902defc  docs: improve quick start document (#213)
902defc is described below

commit 902defc777bdd84680fdc5d10f3fc28a298c5c43
Author: 张呈熹 <or...@163.com>
AuthorDate: Wed Nov 9 14:58:30 2022 +0800

    docs: improve quick start document (#213)
---
 docs/zh/quick-start.md | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/docs/zh/quick-start.md b/docs/zh/quick-start.md
index c0c8107..886e9de 100644
--- a/docs/zh/quick-start.md
+++ b/docs/zh/quick-start.md
@@ -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);
     }
 }
 ```
@@ -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
 
+ADD apache-apisix-java-plugin-runner-${your_plugin_version}-SNAPSHOT-bin.tar.gz /usr/local/
 ```
 
 然后构建容器镜像
@@ -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 端口远程调试插件。
+
 ### 使用插件
 
 配置路由