You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/11/01 15:50:11 UTC

[camel-quarkus] branch master updated: Fix #357 Make netty-http dependent on netty and remove the duplications (#365)

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

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/master by this push:
     new f8fd325  Fix #357 Make netty-http dependent on netty and remove the duplications (#365)
f8fd325 is described below

commit f8fd325c04eb65f7b0cc1cdaff031d58aa8226af
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Fri Nov 1 16:50:05 2019 +0100

    Fix #357 Make netty-http dependent on netty and remove the duplications (#365)
---
 docs/modules/ROOT/pages/extensions/netty-http.adoc | 44 +++++++++++++++++++++
 docs/modules/ROOT/pages/extensions/netty.adoc      |  2 +-
 .../pages/list-of-camel-quarkus-extensions.adoc    |  2 +-
 extensions/netty-http/deployment/pom.xml           | 20 ++++++----
 .../netty/http/deployment/NettyHTTPProcessor.java  |  2 +-
 extensions/netty-http/runtime/pom.xml              |  9 ++---
 ...ubstituteNettyServerBootstrapConfiguration.java | 29 --------------
 .../SubstituteNettyServerBossPoolBuilder.java      | 46 ----------------------
 .../runtime/SubstituteNettyWorkerPoolBuilder.java  | 46 ----------------------
 extensions/readme.adoc                             |  2 +-
 10 files changed, 64 insertions(+), 138 deletions(-)

diff --git a/docs/modules/ROOT/pages/extensions/netty-http.adoc b/docs/modules/ROOT/pages/extensions/netty-http.adoc
new file mode 100644
index 0000000..23595bb
--- /dev/null
+++ b/docs/modules/ROOT/pages/extensions/netty-http.adoc
@@ -0,0 +1,44 @@
+[[netty]]
+= Netty HTTP Extension
+
+*Since Camel Quarkus 0.2*
+
+The Netty HTTP extension provides HTTP transport on top of the xref:extensions/netty.adoc[Netty extension].
+
+Maven users will need to add the following dependency to their `pom.xml` for this extension.
+
+[source,xml]
+------------------------------------------------------------
+<dependency>
+    <groupId>org.apache.camel.quarkus</groupId>
+    <artifactId>camel-quarkus-netty-http</artifactId>
+</dependency>
+------------------------------------------------------------
+
+== Usage
+
+Please refer to the https://camel.apache.org/components/latest/netty-http-component.html[Netty HTTP] component page.
+
+Also read the xref:extensions/netty.adoc[Netty extension] page that may contain some Quarkus specific information.
+
+=== Example Usage
+
+[source,java]
+----
+public class CamelRoute extends RouteBuilder {
+
+    @Override
+    public void configure() {
+
+        /* consumer */
+        from("netty-http:http://0.0.0.0:8999/foo")
+            .transform().constant("Netty Hello World");
+
+        /* /producer is proxying /foo */
+        from("netty-http:http://0.0.0.0:8999/producer")
+            .to("netty-http:http://localhost:8999/foo");
+
+    }
+}
+----
+
diff --git a/docs/modules/ROOT/pages/extensions/netty.adoc b/docs/modules/ROOT/pages/extensions/netty.adoc
index 16dd3f2..1095042 100644
--- a/docs/modules/ROOT/pages/extensions/netty.adoc
+++ b/docs/modules/ROOT/pages/extensions/netty.adoc
@@ -17,7 +17,7 @@ Maven users will need to add the following dependency to their `pom.xml` for thi
 
 == Usage
 
-The extension provides experimental support for the Camel https://camel.apache.org/components/latest/netty-component.html[Netty Component].
+The extension provides support for the Camel https://camel.apache.org/components/latest/netty-component.html[Netty Component].
 
 === Example Usage
 
diff --git a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
index f7393af..a04a5fa 100644
--- a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
+++ b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
@@ -54,7 +54,7 @@ Number of Camel components: 27 in 23 JAR artifacts (0 deprecated)
 | xref:extensions/netty.adoc[Netty] (camel-quarkus-netty) +
 `netty:protocol:host:port` | 0.4 | Socket level networking using TCP or UDP with the Netty 4.x library.
 
-| link:https://camel.apache.org/components/latest/netty-http-component.html[Netty HTTP] (camel-quarkus-netty-http) +
+| xref:extensions/netty-http.adoc[Netty HTTP] (camel-quarkus-netty-http) +
 `netty-http:protocol:host:port/path` | 0.2 | Netty HTTP server and client using the Netty 4.x library.
 
 | link:https://camel.apache.org/components/latest/paho-component.html[Paho] (camel-quarkus-paho) +
diff --git a/extensions/netty-http/deployment/pom.xml b/extensions/netty-http/deployment/pom.xml
index bf23b18..a0c79c2 100644
--- a/extensions/netty-http/deployment/pom.xml
+++ b/extensions/netty-http/deployment/pom.xml
@@ -42,24 +42,28 @@
 
     <dependencies>
         <dependency>
-            <groupId>io.quarkus</groupId>
-            <artifactId>quarkus-netty-deployment</artifactId>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-core-deployment</artifactId>
         </dependency>
         <dependency>
-            <groupId>io.quarkus</groupId>
-            <artifactId>quarkus-caffeine-deployment</artifactId>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-netty-deployment</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-core-deployment</artifactId>
+            <artifactId>camel-quarkus-http-common-deployment</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-netty-http</artifactId>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-netty-deployment</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>io.quarkus</groupId>
+            <artifactId>quarkus-caffeine-deployment</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-http-common-deployment</artifactId>
+            <artifactId>camel-quarkus-netty-http</artifactId>
         </dependency>
     </dependencies>
 
diff --git a/extensions/netty-http/deployment/src/main/java/org/apache/camel/quarkus/component/netty/http/deployment/NettyHTTPProcessor.java b/extensions/netty-http/deployment/src/main/java/org/apache/camel/quarkus/component/netty/http/deployment/NettyHTTPProcessor.java
index 034ef8e..6714e3f 100644
--- a/extensions/netty-http/deployment/src/main/java/org/apache/camel/quarkus/component/netty/http/deployment/NettyHTTPProcessor.java
+++ b/extensions/netty-http/deployment/src/main/java/org/apache/camel/quarkus/component/netty/http/deployment/NettyHTTPProcessor.java
@@ -21,7 +21,7 @@ import io.quarkus.deployment.builditem.FeatureBuildItem;
 
 class NettyHTTPProcessor {
 
-    private static final String FEATURE = "camel-netty-http4";
+    private static final String FEATURE = "camel-netty-http";
 
     @BuildStep
     FeatureBuildItem feature() {
diff --git a/extensions/netty-http/runtime/pom.xml b/extensions/netty-http/runtime/pom.xml
index 2dd468a..c14f1d4 100644
--- a/extensions/netty-http/runtime/pom.xml
+++ b/extensions/netty-http/runtime/pom.xml
@@ -51,6 +51,10 @@
         </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-netty</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-http-common</artifactId>
         </dependency>
         <dependency>
@@ -71,11 +75,6 @@
                 </exclusion>
             </exclusions>
         </dependency>
-
-        <dependency>
-            <groupId>com.oracle.substratevm</groupId>
-            <artifactId>svm</artifactId>
-        </dependency>
     </dependencies>
 
     <build>
diff --git a/extensions/netty-http/runtime/src/main/java/org/apache/camel/quarkus/component/netty/http/runtime/SubstituteNettyServerBootstrapConfiguration.java b/extensions/netty-http/runtime/src/main/java/org/apache/camel/quarkus/component/netty/http/runtime/SubstituteNettyServerBootstrapConfiguration.java
deleted file mode 100644
index d08786f..0000000
--- a/extensions/netty-http/runtime/src/main/java/org/apache/camel/quarkus/component/netty/http/runtime/SubstituteNettyServerBootstrapConfiguration.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.
- */
-package org.apache.camel.quarkus.component.netty.http.runtime;
-
-import com.oracle.svm.core.annotate.Substitute;
-import com.oracle.svm.core.annotate.TargetClass;
-import org.apache.camel.component.netty.NettyServerBootstrapConfiguration;
-
-@TargetClass(NettyServerBootstrapConfiguration.class)
-final class SubstituteNettyServerBootstrapConfiguration {
-    @Substitute
-    public boolean isNativeTransport() {
-        return false;
-    }
-}
diff --git a/extensions/netty-http/runtime/src/main/java/org/apache/camel/quarkus/component/netty/http/runtime/SubstituteNettyServerBossPoolBuilder.java b/extensions/netty-http/runtime/src/main/java/org/apache/camel/quarkus/component/netty/http/runtime/SubstituteNettyServerBossPoolBuilder.java
deleted file mode 100644
index d1ce789..0000000
--- a/extensions/netty-http/runtime/src/main/java/org/apache/camel/quarkus/component/netty/http/runtime/SubstituteNettyServerBossPoolBuilder.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.
- */
-package org.apache.camel.quarkus.component.netty.http.runtime;
-
-import com.oracle.svm.core.annotate.Alias;
-import com.oracle.svm.core.annotate.Substitute;
-import com.oracle.svm.core.annotate.TargetClass;
-import io.netty.channel.EventLoopGroup;
-import io.netty.channel.nio.NioEventLoopGroup;
-import org.apache.camel.component.netty.NettyServerBossPoolBuilder;
-import org.apache.camel.util.concurrent.CamelThreadFactory;
-
-@TargetClass(NettyServerBossPoolBuilder.class)
-final class SubstituteNettyServerBossPoolBuilder {
-
-    @Alias
-    private String name = "NettyServerBoss";
-    @Alias
-    private String pattern;
-    @Alias
-    private int bossCount = 1;
-    @Alias
-    private boolean nativeTransport;
-
-    /**
-     * Creates a new boss pool.
-     */
-    @Substitute
-    public EventLoopGroup build() {
-        return new NioEventLoopGroup(bossCount, new CamelThreadFactory(pattern, name, false));
-    }
-}
diff --git a/extensions/netty-http/runtime/src/main/java/org/apache/camel/quarkus/component/netty/http/runtime/SubstituteNettyWorkerPoolBuilder.java b/extensions/netty-http/runtime/src/main/java/org/apache/camel/quarkus/component/netty/http/runtime/SubstituteNettyWorkerPoolBuilder.java
deleted file mode 100644
index 823a22a..0000000
--- a/extensions/netty-http/runtime/src/main/java/org/apache/camel/quarkus/component/netty/http/runtime/SubstituteNettyWorkerPoolBuilder.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.
- */
-package org.apache.camel.quarkus.component.netty.http.runtime;
-
-import com.oracle.svm.core.annotate.Alias;
-import com.oracle.svm.core.annotate.Substitute;
-import com.oracle.svm.core.annotate.TargetClass;
-import io.netty.channel.EventLoopGroup;
-import io.netty.channel.nio.NioEventLoopGroup;
-import org.apache.camel.component.netty.NettyHelper;
-import org.apache.camel.component.netty.NettyWorkerPoolBuilder;
-import org.apache.camel.util.concurrent.CamelThreadFactory;
-
-@TargetClass(NettyWorkerPoolBuilder.class)
-final class SubstituteNettyWorkerPoolBuilder {
-
-    @Alias
-    private String name = "NettyWorker";
-    @Alias
-    private String pattern;
-    @Alias
-    private int workerCount;
-    @Alias
-    private volatile EventLoopGroup workerPool;
-
-    @Substitute
-    public EventLoopGroup build() {
-        int count = workerCount > 0 ? workerCount : NettyHelper.DEFAULT_IO_THREADS;
-        workerPool = new NioEventLoopGroup(count, new CamelThreadFactory(pattern, name, false));
-        return workerPool;
-    }
-}
diff --git a/extensions/readme.adoc b/extensions/readme.adoc
index a8c8d53..af2a488 100644
--- a/extensions/readme.adoc
+++ b/extensions/readme.adoc
@@ -53,7 +53,7 @@ Number of Camel components: 27 in 23 JAR artifacts (0 deprecated)
 | xref:extensions/netty.adoc[Netty] (camel-quarkus-netty) +
 `netty:protocol:host:port` | 0.4 | Socket level networking using TCP or UDP with the Netty 4.x library.
 
-| link:https://camel.apache.org/components/latest/netty-http-component.html[Netty HTTP] (camel-quarkus-netty-http) +
+| xref:extensions/netty-http.adoc[Netty HTTP] (camel-quarkus-netty-http) +
 `netty-http:protocol:host:port/path` | 0.2 | Netty HTTP server and client using the Netty 4.x library.
 
 | link:https://camel.apache.org/components/latest/paho-component.html[Paho] (camel-quarkus-paho) +