You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/07/21 06:52:27 UTC

[GitHub] [apisix-java-plugin-runner] ericluoliu opened a new pull request, #169: docs: add documentation for writing plugins using Maven JAR

ericluoliu opened a new pull request, #169:
URL: https://github.com/apache/apisix-java-plugin-runner/pull/169

   The documentation currently references my Maven coordinates (io.github.ericluoliu). Once the official Maven coordinates are released, I will change this.
   
   Related PR: https://github.com/apache/apisix-java-plugin-runner/pull/155
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-java-plugin-runner] tzssangglass merged pull request #169: docs: add documentation for writing plugins using Maven JAR

Posted by GitBox <gi...@apache.org>.
tzssangglass merged PR #169:
URL: https://github.com/apache/apisix-java-plugin-runner/pull/169


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-java-plugin-runner] ericluoliu commented on pull request #169: docs: add documentation for writing plugins using Maven JAR

Posted by GitBox <gi...@apache.org>.
ericluoliu commented on PR #169:
URL: https://github.com/apache/apisix-java-plugin-runner/pull/169#issuecomment-1191115782

   From the user's perspective, I can now run the java-plugin-runner and package my filters in a JAR without having to copy the java-plugin-runner repo. However, apisix cannot find the filter when I run both processes, still working on resolving this...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-java-plugin-runner] tzssangglass commented on pull request #169: docs: add documentation for writing plugins using Maven JAR

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on PR #169:
URL: https://github.com/apache/apisix-java-plugin-runner/pull/169#issuecomment-1192145955

   We can wait to merge this PR and I will merge it when I release this project to maven center.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-java-plugin-runner] tzssangglass commented on pull request #169: docs: add documentation for writing plugins using Maven JAR

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on PR #169:
URL: https://github.com/apache/apisix-java-plugin-runner/pull/169#issuecomment-1192145515

   LGTM


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-java-plugin-runner] tzssangglass commented on a diff in pull request #169: docs: add documentation for writing plugins using Maven JAR

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #169:
URL: https://github.com/apache/apisix-java-plugin-runner/pull/169#discussion_r937329678


##########
docs/en/latest/writing-filters.md:
##########
@@ -0,0 +1,165 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+# Overview
+
+This document explains how to develop Java plugins using apisix-java-plugin-runner's official Maven release.
+
+A Demo Project can be found at: https://github.com/ericluoliu/java-plugin-runner-demo
+
+___
+
+Create a new Maven Spring Boot Project.
+
+Add the apisix-java-plugin-runner Maven release as a dependency
+```
+#TODO: needs to be changed once once official java-plugin-runner release is on Maven
+<dependency>
+    <groupId>io.github.ericluoliu</groupId> 
+    <artifactId>apisix-runner-starter</artifactId>
+    <version>0.5.0</version>
+</dependency>

Review Comment:
   ```suggestion
   <dependency>
       <groupId>org.apache.apisix</groupId> 
       <artifactId>apisix-runner-starter</artifactId>
       <version>0.3.0</version>
   </dependency>
   ```



##########
docs/en/latest/writing-filters.md:
##########
@@ -0,0 +1,165 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+# Overview
+
+This document explains how to develop Java plugins using apisix-java-plugin-runner's official Maven release.
+
+A Demo Project can be found at: https://github.com/ericluoliu/java-plugin-runner-demo
+
+___
+
+Create a new Maven Spring Boot Project.
+
+Add the apisix-java-plugin-runner Maven release as a dependency

Review Comment:
   ```suggestion
   Add the GAV of `apisix-java-plugin-runner` in `pom.xml`.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-java-plugin-runner] tzssangglass commented on pull request #169: docs: add documentation for writing plugins using Maven JAR

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on PR #169:
URL: https://github.com/apache/apisix-java-plugin-runner/pull/169#issuecomment-1204735194

   hi @ericluoliu , 
   
   ```
           <dependency>
               <groupId>org.apache.apisix</groupId>
               <artifactId>apisix-runner-starter</artifactId>
               <version>0.3.0-SNAPSHOT</version>
           </dependency>
   ```
   
   has been pushed, so we can replace all `io.github.ericluoliu` in this document with `org.apache.apisix`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-java-plugin-runner] tzssangglass commented on a diff in pull request #169: docs: add documentation for writing plugins using Maven JAR

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #169:
URL: https://github.com/apache/apisix-java-plugin-runner/pull/169#discussion_r938387378


##########
docs/en/latest/writing-filters.md:
##########
@@ -0,0 +1,161 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+# Overview
+
+This document explains how to develop Java plugins using apisix-java-plugin-runner's official Maven release.
+
+A Demo Project can be found at: https://github.com/tzssangglass/java-plugin-runner-demo-1
+
+___
+
+Create a new Maven Spring Boot Project.
+
+Add the GAV of `apisix-java-plugin-runner` in `pom.xml`.
+```
+<dependency>
+    <groupId>org.apache.apisix</groupId> 
+    <artifactId>apisix-runner-starter</artifactId>
+    <version>0.3.0</version>
+</dependency>
+```
+Be sure to add the Maven JAR into the class path. Use `org.apache.apisix:apisix-runner-starter:0.3.0` when asked for Maven coordinates. For Intellij IDEA users unsure on how to add files to the class path, follow https://stackoverflow.com/questions/16742085/adding-jar-files-to-intellijidea-classpath.
+
+To prevent multiple slf4j (a facade for various logging frameworks) bindings, exclude the *logback-classic* and *log4j-to-slf4j* transitive dependencies from being built within *spring-boot-starter*
+
+```
+<dependency>
+    <groupId>org.springframework.boot</groupId>
+    <artifactId>spring-boot-starter</artifactId>
+    <exclusions>
+           <exclusion>
+                <groupId>ch.qos.logback</groupId>
+                <artifactId>logback-classic</artifactId>
+           </exclusion>
+           <exclusion>
+                <groupId>org.apache.logging.log4j</groupId>
+                <artifactId>log4j-to-slf4j</artifactId>
+           </exclusion>
+    </exclusions>
+</dependency>
+```
+The final pom.xml file should look similar to
+```
+<?xml version="1.0" encoding="UTF-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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.7.1</version>
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
+    <groupId>com.example</groupId>
+    <artifactId>demo</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <name>demo</name>
+    <description>demo</description>
+    <properties>
+        <java.version>11</java.version>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>ch.qos.logback</groupId>
+                    <artifactId>logback-classic</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.apache.logging.log4j</groupId>
+                    <artifactId>log4j-to-slf4j</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+            <groupId>org.apache.apisix</groupId> 
+            <artifactId>apisix-runner-starter</artifactId>
+            <version>0.3.0</version>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <excludes>
+                        <exclude>
+                            <groupId>org.projectlombok</groupId>
+                            <artifactId>lombok</artifactId>
+                        </exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
+```
+
+In the Java main class, include the line
+```
+@SpringBootApplication(scanBasePackages = {"your-filter's-package-name","org.apache.apisix.plugin.runner"})
+```
+*scanBasePackages* allows Spring Boot to read the *@Component* classes that exist inside of the Maven JAR along with the implemented Java filter.
+
+An example main class looks like
+```
+package com.example.demo;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication(scanBasePackages = {"com.example.demo","org.apache.apisix.plugin.runner"})
+public class DemoApplication {
+    public static void main(String[] args) {
+        SpringApplication.run(DemoApplication.class, args);
+    }
+
+}
+```
+
+In *~/src/main/resources/application.properties*, add
+```
+socket.file = /tmp/runner.sock
+```
+This allows our java-plugin-runner to communicate with the main APISIX process.
+
+Finally, build your Java plugin! Be sure to label each filter class as a Spring *@Component* while following the guide at:
+https://github.com/apache/apisix-java-plugin-runner/blob/main/docs/en/latest/development.md
+
+

Review Comment:
   Only one blank line should be left at the end



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org