You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2018/12/04 14:10:00 UTC

[camel] branch sandbox/camel-3.x updated (f53a549 -> 541d6b6)

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

acosentino pushed a change to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from f53a549  CAMEL-12865: camel-restdsl-swagger-plugin - Allow for specifying apiContextPath
     new b1e30af  CAMEL-12869: ReplyTo destination must match endpoint type (topic or queue) that the message is sent on
     new 356c807  CAMEL-12908: Add reproducer code
     new 4755902  CAMEL-12908: Cannot start route using rest dsl due to a mysterious duplicate route id Conflicts: 	camel-core/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java
     new 127b0e5  CAMEL-12908: Fix CS
     new a3778e6  Fixed CS
     new c1353c4  Upgrade Ehcache to version 3.6.2
     new a9920a4  CAMEL-12759 - Misleading documentation for Netty components - Netty4
     new 541d6b6  CAMEL-12759 - Misleading documentation for Netty components - Netty4-http

The 8 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/camel/model/RouteDefinitionHelper.java  | 33 +++++++++++++++++++++-
 .../apache/camel/model/rest/RestDefinition.java    | 17 -----------
 .../apache/camel/model/rest/VerbDefinition.java    |  2 +-
 .../src/main/docs/netty4-http-component.adoc       |  4 +--
 .../src/main/docs/netty4-component.adoc            | 26 ++++++++---------
 .../camel-sjms/src/main/docs/sjms-component.adoc   |  2 +-
 .../apache/camel/component/sjms/SjmsConsumer.java  |  2 +-
 .../apache/camel/component/sjms/SjmsEndpoint.java  |  6 ++--
 .../component/sjms/batch/SjmsBatchConsumer.java    |  2 +-
 .../component/sjms/batch/SjmsBatchEndpoint.java    |  4 +--
 .../component/sjms/jms/DestinationNameParser.java  | 13 +++++++++
 .../component/sjms/producer/InOutProducer.java     | 11 ++++++--
 .../sjms/batch/ListAggregationStrategy.java        |  2 +-
 .../sjms/batch/SjmsBatchEndpointTest.java          |  3 +-
 .../component/sjms/support/MyAsyncEndpoint.java    |  2 +-
 .../apache/camel/component/rest/RestRefTest.xml    |  2 +-
 parent/pom.xml                                     |  2 +-
 17 files changed, 84 insertions(+), 49 deletions(-)


[camel] 03/08: CAMEL-12908: Cannot start route using rest dsl due to a mysterious duplicate route id Conflicts: camel-core/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 47559028cb151fd2aed8a81352251ad0759f46f3
Author: Dmitry Volodin <dm...@gmail.com>
AuthorDate: Tue Nov 13 16:43:59 2018 +0300

    CAMEL-12908: Cannot start route using rest dsl due to a mysterious
    duplicate route id
    Conflicts:
    	camel-core/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java
---
 .../apache/camel/model/RouteDefinitionHelper.java  | 33 +++++++++++++++++++++-
 .../apache/camel/model/rest/RestDefinition.java    |  6 +++-
 .../apache/camel/model/rest/VerbDefinition.java    |  2 +-
 3 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/camel-core/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java b/camel-core/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java
index 2d544b7..95f6c0b 100644
--- a/camel-core/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java
@@ -19,16 +19,20 @@ package org.apache.camel.model;
 import java.io.UnsupportedEncodingException;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.ErrorHandlerFactory;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.builder.ErrorHandlerBuilder;
+import org.apache.camel.model.rest.RestDefinition;
+import org.apache.camel.model.rest.VerbDefinition;
 import org.apache.camel.support.CamelContextHelper;
 import org.apache.camel.support.EndpointHelper;
 import org.apache.camel.util.ObjectHelper;
@@ -147,10 +151,11 @@ public final class RouteDefinitionHelper {
         for (final RouteDefinition route : routes) {
             if (route.getId() == null) {
                 // keep assigning id's until we find a free name
+                
                 boolean done = false;
                 String id = null;
                 while (!done) {
-                    id = context.getNodeIdFactory().createId(route);
+                    id = route.idOrCreate(context.getNodeIdFactory());
                     done = !customIds.contains(id);
                 }
                 route.setId(id);
@@ -164,6 +169,32 @@ public final class RouteDefinitionHelper {
                 route.setCustomId(false);
                 customIds.add(route.getId());
             }
+            RestDefinition rest = route.getRestDefinition();
+            if (rest != null && route.isRest()) {
+                for (VerbDefinition verb : rest.getVerbs()) {
+                    String id = verb.idOrCreate(context.getNodeIdFactory());
+                    if (!verb.getUsedForGeneratingNodeId()) {
+                        id = route.getId();
+                    }
+                    verb.setRouteId(id);
+                }
+                List<FromDefinition> fromDefinitions = route.getInputs();
+                
+                if (ObjectHelper.isNotEmpty(fromDefinitions)) {
+                    FromDefinition fromDefinition = fromDefinitions.get(0);
+                    String endpointUri = fromDefinition.getEndpointUri();
+                    if (ObjectHelper.isNotEmpty(endpointUri)) {
+                        Map<String, Object> options = new HashMap<String, Object>();
+                        options.put("routeId", route.getId());
+                        endpointUri = URISupport.appendParametersToURI(endpointUri, options);
+                     
+                        // replace uri with new routeId
+                        fromDefinition.setUri(endpointUri);
+                        fromDefinitions.set(0, fromDefinition);
+                        route.setInputs(fromDefinitions);
+                    }
+                }
+            }
         }
     }
 
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
index 3402f1d..dd7ddc0 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
@@ -854,6 +854,7 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
                 options.put("outType", outType);
             }
             // if no route id has been set, then use the verb id as route id
+            /*
             if (!route.hasCustomIdAssigned()) {
                 // use id of verb as route id
                 String id = verb.getId();
@@ -861,7 +862,9 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
                     route.setId(id);
                 }
             }
+            */
 
+            /*
             String routeId = verb.idOrCreate(camelContext.getNodeIdFactory());
 
             if (!verb.getUsedForGeneratingNodeId()) {
@@ -870,6 +873,7 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
 
             verb.setRouteId(routeId);
             options.put("routeId", routeId);
+            */
             if (component != null && !component.isEmpty()) {
                 options.put("componentName", component);
             }
@@ -963,7 +967,7 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
 
             // the route should be from this rest endpoint
             route.fromRest(from);
-            route.routeId(routeId);
+            //route.routeId(routeId);
             route.setRestDefinition(this);
             answer.add(route);
         }
diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
index 75ae044..19c39df 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/VerbDefinition.java
@@ -141,7 +141,7 @@ public class VerbDefinition extends OptionalIdentifiedDefinition<VerbDefinition>
     /**
      * Sets swagger operation response messages.
      */
-    public void setResponseMsgs(List<RestOperationResponseMsgDefinition> params) {
+    public void setResponseMsgs(List<RestOperationResponseMsgDefinition> responseMsgs) {
         this.responseMsgs = responseMsgs;
     }
 


[camel] 02/08: CAMEL-12908: Add reproducer code

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 356c807bfa83813d390bbfcbb3fbe60ec4fcd569
Author: Dmitry Volodin <dm...@gmail.com>
AuthorDate: Thu Nov 1 20:25:04 2018 +0300

    CAMEL-12908: Add reproducer code
---
 .../src/test/resources/org/apache/camel/component/rest/RestRefTest.xml  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/components/camel-spring/src/test/resources/org/apache/camel/component/rest/RestRefTest.xml b/components/camel-spring/src/test/resources/org/apache/camel/component/rest/RestRefTest.xml
index c53d943..246c2a9 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/component/rest/RestRefTest.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/component/rest/RestRefTest.xml
@@ -54,7 +54,7 @@
         <constant>Hello World</constant>
       </transform>
     </route>
-    <route>
+    <route id="route1">
       <from uri="direct:bye"/>
       <transform>
         <constant>Bye World</constant>


[camel] 05/08: Fixed CS

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit a3778e6e96a3dc3406fb6c657e932f110b8a3beb
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Dec 4 15:02:21 2018 +0100

    Fixed CS
---
 .../src/main/java/org/apache/camel/component/sjms/SjmsConsumer.java   | 2 +-
 .../src/main/java/org/apache/camel/component/sjms/SjmsEndpoint.java   | 4 ++--
 .../java/org/apache/camel/component/sjms/batch/SjmsBatchConsumer.java | 2 +-
 .../java/org/apache/camel/component/sjms/batch/SjmsBatchEndpoint.java | 4 ++--
 .../apache/camel/component/sjms/batch/ListAggregationStrategy.java    | 2 +-
 .../org/apache/camel/component/sjms/batch/SjmsBatchEndpointTest.java  | 3 ++-
 .../java/org/apache/camel/component/sjms/support/MyAsyncEndpoint.java | 2 +-
 7 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConsumer.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConsumer.java
index e9f86f6..0456b8f 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConsumer.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsConsumer.java
@@ -36,8 +36,8 @@ import org.apache.camel.component.sjms.tx.BatchTransactionCommitStrategy;
 import org.apache.camel.component.sjms.tx.DefaultTransactionCommitStrategy;
 import org.apache.camel.component.sjms.tx.SessionBatchTransactionSynchronization;
 import org.apache.camel.component.sjms.tx.SessionTransactionSynchronization;
-import org.apache.camel.support.DefaultConsumer;
 import org.apache.camel.spi.Synchronization;
+import org.apache.camel.support.DefaultConsumer;
 import org.apache.commons.pool.BasePoolableObjectFactory;
 import org.apache.commons.pool.impl.GenericObjectPool;
 
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsEndpoint.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsEndpoint.java
index b593f9c..08ed02e 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsEndpoint.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsEndpoint.java
@@ -45,15 +45,15 @@ import org.apache.camel.component.sjms.jms.MessageCreatedStrategy;
 import org.apache.camel.component.sjms.jms.SessionAcknowledgementType;
 import org.apache.camel.component.sjms.producer.InOnlyProducer;
 import org.apache.camel.component.sjms.producer.InOutProducer;
-import org.apache.camel.support.DefaultEndpoint;
 import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.spi.HeaderFilterStrategyAware;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriPath;
-import org.apache.camel.support.LoggingExceptionHandler;
+import org.apache.camel.support.DefaultEndpoint;
 import org.apache.camel.support.EndpointHelper;
+import org.apache.camel.support.LoggingExceptionHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/batch/SjmsBatchConsumer.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/batch/SjmsBatchConsumer.java
index 20c4d13..b59af05 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/batch/SjmsBatchConsumer.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/batch/SjmsBatchConsumer.java
@@ -36,12 +36,12 @@ import javax.jms.MessageConsumer;
 import javax.jms.Queue;
 import javax.jms.Session;
 
+import org.apache.camel.AggregationStrategy;
 import org.apache.camel.Exchange;
 import org.apache.camel.Predicate;
 import org.apache.camel.Processor;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.support.DefaultConsumer;
-import org.apache.camel.AggregationStrategy;
 import org.apache.camel.util.ObjectHelper;
 import org.apache.camel.util.StringHelper;
 import org.slf4j.Logger;
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/batch/SjmsBatchEndpoint.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/batch/SjmsBatchEndpoint.java
index 4790e01..366457b 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/batch/SjmsBatchEndpoint.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/batch/SjmsBatchEndpoint.java
@@ -21,6 +21,7 @@ import java.util.concurrent.ScheduledExecutorService;
 import javax.jms.Message;
 import javax.jms.Session;
 
+import org.apache.camel.AggregationStrategy;
 import org.apache.camel.Component;
 import org.apache.camel.Consumer;
 import org.apache.camel.Exchange;
@@ -34,15 +35,14 @@ import org.apache.camel.component.sjms.jms.DestinationNameParser;
 import org.apache.camel.component.sjms.jms.JmsBinding;
 import org.apache.camel.component.sjms.jms.JmsKeyFormatStrategy;
 import org.apache.camel.component.sjms.jms.MessageCreatedStrategy;
-import org.apache.camel.support.DefaultEndpoint;
 import org.apache.camel.language.simple.SimpleLanguage;
-import org.apache.camel.AggregationStrategy;
 import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.spi.HeaderFilterStrategyAware;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriPath;
+import org.apache.camel.support.DefaultEndpoint;
 
 /**
  * The sjms-batch component is a specialized for highly performant, transactional batch consumption from a JMS queue.
diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/batch/ListAggregationStrategy.java b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/batch/ListAggregationStrategy.java
index 596bd40..2c2e1aa 100644
--- a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/batch/ListAggregationStrategy.java
+++ b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/batch/ListAggregationStrategy.java
@@ -19,8 +19,8 @@ package org.apache.camel.component.sjms.batch;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.camel.Exchange;
 import org.apache.camel.AggregationStrategy;
+import org.apache.camel.Exchange;
 
 public class ListAggregationStrategy implements AggregationStrategy {
 
diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/batch/SjmsBatchEndpointTest.java b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/batch/SjmsBatchEndpointTest.java
index b927e2c..08fec80 100644
--- a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/batch/SjmsBatchEndpointTest.java
+++ b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/batch/SjmsBatchEndpointTest.java
@@ -15,15 +15,16 @@
  * limitations under the License.
  */
 package org.apache.camel.component.sjms.batch;
+
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.camel.CamelContext;
 import org.apache.camel.FailedToCreateRouteException;
+import org.apache.camel.builder.AggregationStrategies;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.sjms.SjmsComponent;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.impl.SimpleRegistry;
 import org.apache.camel.test.junit4.CamelTestSupport;
-import org.apache.camel.builder.AggregationStrategies;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
diff --git a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/support/MyAsyncEndpoint.java b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/support/MyAsyncEndpoint.java
index c5c29d0..6eaeae7 100644
--- a/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/support/MyAsyncEndpoint.java
+++ b/components/camel-sjms/src/test/java/org/apache/camel/component/sjms/support/MyAsyncEndpoint.java
@@ -20,8 +20,8 @@ import org.apache.camel.Component;
 import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
-import org.apache.camel.support.DefaultEndpoint;
 import org.apache.camel.impl.SynchronousDelegateProducer;
+import org.apache.camel.support.DefaultEndpoint;
 
 /**
  *


[camel] 08/08: CAMEL-12759 - Misleading documentation for Netty components - Netty4-http

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 541d6b620dbcd085f0d4962594257aa5bca12111
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Nov 16 12:00:26 2018 +0100

    CAMEL-12759 - Misleading documentation for Netty components - Netty4-http
---
 components/camel-netty4-http/src/main/docs/netty4-http-component.adoc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/components/camel-netty4-http/src/main/docs/netty4-http-component.adoc b/components/camel-netty4-http/src/main/docs/netty4-http-component.adoc
index 52ceb67..18091e7 100644
--- a/components/camel-netty4-http/src/main/docs/netty4-http-component.adoc
+++ b/components/camel-netty4-http/src/main/docs/netty4-http-component.adoc
@@ -39,7 +39,7 @@ The URI scheme for a netty component is as follows
 
 [source,java]
 -------------------------------------------
-netty4-http:http://localhost:8080[?options]
+netty4-http:http://0.0.0.0:8080[?options]
 -------------------------------------------
 
 You can append query options to the URI in the following format,
@@ -362,7 +362,7 @@ ProducerTemplate as shown below:
 
 [source,java]
 ------------------------------------------------------------------------------------------------------------
-    String out = template.requestBody("netty4-http:http://localhost:8080/foo", "Hello World", String.class);
+    String out = template.requestBody("netty4-http:http://0.0.0.0:8080/foo", "Hello World", String.class);
     System.out.println(out);
 ------------------------------------------------------------------------------------------------------------
 


[camel] 06/08: Upgrade Ehcache to version 3.6.2

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit c1353c44d78daa44298dd3b3b18e4daf384fca58
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Nov 16 11:16:53 2018 +0100

    Upgrade Ehcache to version 3.6.2
---
 parent/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/parent/pom.xml b/parent/pom.xml
index 704806d..7976913 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -190,7 +190,7 @@
     <egit-github-core-version>2.1.5</egit-github-core-version>
     <egit-github-core-bundle-version>2.1.5_1</egit-github-core-bundle-version>
     <ehcache-version>2.10.6</ehcache-version>
-    <ehcache3-version>3.6.1</ehcache3-version>
+    <ehcache3-version>3.6.2</ehcache3-version>
     <ekstazi-maven-plugin-version>5.3.0</ekstazi-maven-plugin-version>
     <elasticsearch-bundle-version>2.4.4_1</elasticsearch-bundle-version>
     <elasticsearch-guava-version>18.0</elasticsearch-guava-version>


[camel] 04/08: CAMEL-12908: Fix CS

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 127b0e55eda0a4cec320ca1fc3019be8a67059f1
Author: Dmitry Volodin <dm...@gmail.com>
AuthorDate: Tue Nov 13 16:53:26 2018 +0300

    CAMEL-12908: Fix CS
---
 .../org/apache/camel/model/rest/RestDefinition.java | 21 ---------------------
 1 file changed, 21 deletions(-)

diff --git a/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java b/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
index dd7ddc0..d672225 100644
--- a/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/rest/RestDefinition.java
@@ -853,27 +853,7 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
             if (outType != null) {
                 options.put("outType", outType);
             }
-            // if no route id has been set, then use the verb id as route id
-            /*
-            if (!route.hasCustomIdAssigned()) {
-                // use id of verb as route id
-                String id = verb.getId();
-                if (id != null) {
-                    route.setId(id);
-                }
-            }
-            */
-
-            /*
-            String routeId = verb.idOrCreate(camelContext.getNodeIdFactory());
-
-            if (!verb.getUsedForGeneratingNodeId()) {
-                routeId = route.idOrCreate(camelContext.getNodeIdFactory());
-            }
 
-            verb.setRouteId(routeId);
-            options.put("routeId", routeId);
-            */
             if (component != null && !component.isEmpty()) {
                 options.put("componentName", component);
             }
@@ -967,7 +947,6 @@ public class RestDefinition extends OptionalIdentifiedDefinition<RestDefinition>
 
             // the route should be from this rest endpoint
             route.fromRest(from);
-            //route.routeId(routeId);
             route.setRestDefinition(this);
             answer.add(route);
         }


[camel] 07/08: CAMEL-12759 - Misleading documentation for Netty components - Netty4

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit a9920a4d4bf41baa25326196312659c2fefb8826
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Nov 16 11:58:37 2018 +0100

    CAMEL-12759 - Misleading documentation for Netty components - Netty4
---
 .../src/main/docs/netty4-component.adoc            | 26 +++++++++++-----------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/components/camel-netty4/src/main/docs/netty4-component.adoc b/components/camel-netty4/src/main/docs/netty4-component.adoc
index 1381961..a40b107 100644
--- a/components/camel-netty4/src/main/docs/netty4-component.adoc
+++ b/components/camel-netty4/src/main/docs/netty4-component.adoc
@@ -37,7 +37,7 @@ The URI scheme for a netty component is as follows
 
 [source,text]
 ----
-netty4:tcp://localhost:99999[?options]
+netty4:tcp://0.0.0.0:99999[?options]
 netty4:udp://remotehost:99999/[?options]
 ----
 
@@ -360,7 +360,7 @@ operations.
 ----
 RouteBuilder builder = new RouteBuilder() {
   public void configure() {
-    from("netty4:udp://localhost:5155?sync=true")
+    from("netty4:udp://0.0.0.0:5155?sync=true")
       .process(new Processor() {
          public void process(Exchange exchange) throws Exception {
            Poetry poetry = (Poetry) exchange.getIn().getBody();
@@ -378,7 +378,7 @@ RouteBuilder builder = new RouteBuilder() {
 ----
 RouteBuilder builder = new RouteBuilder() {
   public void configure() {
-       from("netty4:tcp://localhost:5150")
+       from("netty4:tcp://0.0.0.0:5150")
            .to("mock:result");
   }
 };
@@ -432,7 +432,7 @@ Spring DSL based configuration of endpoint
     </camel:keyManagers>
   </camel:sslContextParameters>...
 ...
-  <to uri="netty4:tcp://localhost:5150?sync=true&ssl=true&sslContextParameters=#sslContextParameters"/>
+  <to uri="netty4:tcp://0.0.0.0:5150?sync=true&ssl=true&sslContextParameters=#sslContextParameters"/>
 ...
 ----
 
@@ -450,7 +450,7 @@ context.createRegistry(registry);
 context.addRoutes(new RouteBuilder() {
   public void configure() {
       String netty_ssl_endpoint =
-         "netty4:tcp://localhost:5150?sync=true&ssl=true&passphrase=#password"
+         "netty4:tcp://0.0.0.0:5150?sync=true&ssl=true&passphrase=#password"
          + "&keyStoreFile=#ksf&trustStoreFile=#tsf";
       String return_string =
          "When You Go Home, Tell Them Of Us And Say,"
@@ -578,9 +578,9 @@ a comma separated list or contained in a List e.g.
 
 [source,java]
 ----
- from("direct:multiple-codec").to("netty4:tcp://localhost:{{port}}?encoders=#encoders&sync=false");
+ from("direct:multiple-codec").to("netty4:tcp://0.0.0.0:{{port}}?encoders=#encoders&sync=false");
                 
- from("netty4:tcp://localhost:{{port}}?decoders=#length-decoder,#string-decoder&sync=false").to("mock:multiple-codec");
+ from("netty4:tcp://0.0.0.0:{{port}}?decoders=#length-decoder,#string-decoder&sync=false").to("mock:multiple-codec");
 ----
 
 or via XML.
@@ -590,10 +590,10 @@ or via XML.
 <camelContext id="multiple-netty-codecs-context" xmlns="http://camel.apache.org/schema/spring">
     <route>
         <from uri="direct:multiple-codec"/>
-        <to uri="netty4:tcp://localhost:5150?encoders=#encoders&amp;sync=false"/>
+        <to uri="netty4:tcp://0.0.0.0:5150?encoders=#encoders&amp;sync=false"/>
     </route>
     <route>
-        <from uri="netty4:tcp://localhost:5150?decoders=#length-decoder,#string-decoder&amp;sync=false"/>
+        <from uri="netty4:tcp://0.0.0.0:5150?decoders=#length-decoder,#string-decoder&amp;sync=false"/>
         <to uri="mock:multiple-codec"/>
     </route>
 </camelContext>
@@ -615,7 +615,7 @@ written the bye message back to the client:
 
 [source,java]
 ----
-from("netty4:tcp://localhost:8080").process(new Processor() {
+from("netty4:tcp://0.0.0.0:8080").process(new Processor() {
     public void process(Exchange exchange) throws Exception {
         String body = exchange.getIn().getBody(String.class);
         exchange.getOut().setBody("Bye " + body);
@@ -685,7 +685,7 @@ registry.bind("spf", factory);
 context.addRoutes(new RouteBuilder() {
   public void configure() {
       String netty_ssl_endpoint =
-         "netty4:tcp://localhost:5150?serverInitializerFactory=#spf"
+         "netty4:tcp://0.0.0.0:5150?serverInitializerFactory=#spf"
       String return_string =
          "When You Go Home, Tell Them Of Us And Say,"
          + "For Your Tomorrow, We Gave Our Today.";
@@ -738,7 +738,7 @@ as shown below:
 [source,xml]
 ----
 <route>
-  <from uri="netty4:tcp://localhost:5021?textline=true&amp;sync=true&amp;workerPool=#sharedPool&amp;usingExecutorService=false"/>
+  <from uri="netty4:tcp://0.0.0.0:5021?textline=true&amp;sync=true&amp;workerPool=#sharedPool&amp;usingExecutorService=false"/>
   <to uri="log:result"/>
   ...
 </route>
@@ -749,7 +749,7 @@ And if we have another route we can refer to the shared worker pool:
 [source,xml]
 ----
 <route>
-  <from uri="netty4:tcp://localhost:5022?textline=true&amp;sync=true&amp;workerPool=#sharedPool&amp;usingExecutorService=false"/>
+  <from uri="netty4:tcp://0.0.0.0:5022?textline=true&amp;sync=true&amp;workerPool=#sharedPool&amp;usingExecutorService=false"/>
   <to uri="log:result"/>
   ...
 </route>


[camel] 01/08: CAMEL-12869: ReplyTo destination must match endpoint type (topic or queue) that the message is sent on

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch sandbox/camel-3.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit b1e30af08e4a6ee56e04a124e5c281da307b948e
Author: Dmitry Volodin <dm...@gmail.com>
AuthorDate: Thu Nov 15 18:51:21 2018 +0300

    CAMEL-12869: ReplyTo destination must match endpoint type (topic or
    queue) that the message is sent on
---
 components/camel-sjms/src/main/docs/sjms-component.adoc     |  2 +-
 .../java/org/apache/camel/component/sjms/SjmsEndpoint.java  |  2 ++
 .../camel/component/sjms/jms/DestinationNameParser.java     | 13 +++++++++++++
 .../apache/camel/component/sjms/producer/InOutProducer.java | 11 ++++++++---
 4 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/components/camel-sjms/src/main/docs/sjms-component.adoc b/components/camel-sjms/src/main/docs/sjms-component.adoc
index 6e9ad12..bff4665 100644
--- a/components/camel-sjms/src/main/docs/sjms-component.adoc
+++ b/components/camel-sjms/src/main/docs/sjms-component.adoc
@@ -150,7 +150,7 @@ with the following path and query parameters:
 | *exceptionHandler* (consumer) | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. |  | ExceptionHandler
 | *exchangePattern* (consumer) | Sets the exchange pattern when the consumer creates an exchange. |  | ExchangePattern
 | *messageSelector* (consumer) | Sets the JMS Message selector syntax. |  | String
-| *namedReplyTo* (producer) | Sets the reply to destination name used for InOut producer endpoints. |  | String
+| *namedReplyTo* (producer) | Sets the reply to destination name used for InOut producer endpoints. The type of the reply to destination can be determined by the starting prefix (topic: or queue:) in its name. |  | String
 | *persistent* (producer) | Flag used to enable/disable message persistence. | true | boolean
 | *producerCount* (producer) | Sets the number of producers used for this endpoint. | 1 | int
 | *ttl* (producer) | Flag used to adjust the Time To Live value of produced messages. | -1 | long
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsEndpoint.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsEndpoint.java
index 42d35fd..b593f9c 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsEndpoint.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsEndpoint.java
@@ -563,6 +563,8 @@ public class SjmsEndpoint extends DefaultEndpoint implements AsyncEndpoint, Mult
 
     /**
      * Sets the reply to destination name used for InOut producer endpoints.
+     * The type of the reply to destination can be determined by the starting 
+     * prefix (topic: or queue:) in its name. 
      */
     public void setNamedReplyTo(String namedReplyTo) {
         this.namedReplyTo = namedReplyTo;
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/DestinationNameParser.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/DestinationNameParser.java
index 41eab2d..095d1c9 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/DestinationNameParser.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/DestinationNameParser.java
@@ -27,6 +27,19 @@ public class DestinationNameParser {
         }
         return destinationName.startsWith("topic:");
     }
+    
+    public boolean isNamedReplyToTopic(String namedReplyTo, boolean isDestinationTopic) {
+        if (namedReplyTo == null) {
+            throw new IllegalArgumentException("namedReplyTo is null");
+        }
+        if (namedReplyTo.startsWith("topic:")) {
+            return true;
+        } else if (namedReplyTo.startsWith("queue:")) {
+            return false;
+        } else {
+            return isDestinationTopic;
+        }
+    }
 
     public String getShortName(String destinationName) {
         if (destinationName == null) {
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOutProducer.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOutProducer.java
index 36fc732..3f09738 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOutProducer.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/producer/InOutProducer.java
@@ -38,6 +38,7 @@ import org.apache.camel.component.sjms.SjmsEndpoint;
 import org.apache.camel.component.sjms.SjmsMessage;
 import org.apache.camel.component.sjms.SjmsProducer;
 import org.apache.camel.component.sjms.jms.ConnectionResource;
+import org.apache.camel.component.sjms.jms.DestinationNameParser;
 import org.apache.camel.component.sjms.jms.JmsConstants;
 import org.apache.camel.component.sjms.jms.JmsMessageHelper;
 import org.apache.camel.spi.UuidGenerator;
@@ -87,12 +88,16 @@ public class InOutProducer extends SjmsProducer {
                 }
 
                 Destination replyToDestination;
+                boolean isReplyToTopic = false;
                 if (ObjectHelper.isEmpty(getNamedReplyTo())) {
-                    replyToDestination = getEndpoint().getDestinationCreationStrategy().createTemporaryDestination(session, isTopic());
+                    isReplyToTopic = isTopic();
+                    replyToDestination = getEndpoint().getDestinationCreationStrategy().createTemporaryDestination(session, isReplyToTopic);
                 } else {
-                    replyToDestination = getEndpoint().getDestinationCreationStrategy().createDestination(session, getNamedReplyTo(), isTopic());
+                    DestinationNameParser parser = new DestinationNameParser();
+                    isReplyToTopic = parser.isNamedReplyToTopic(getNamedReplyTo(), isTopic());
+                    replyToDestination = getEndpoint().getDestinationCreationStrategy().createDestination(session, getNamedReplyTo(), isReplyToTopic);
                 }
-                MessageConsumer messageConsumer = getEndpoint().getJmsObjectFactory().createMessageConsumer(session, replyToDestination, null, isTopic(), null, true, false, false);
+                MessageConsumer messageConsumer = getEndpoint().getJmsObjectFactory().createMessageConsumer(session, replyToDestination, null, isReplyToTopic, null, true, false, false);
                 messageConsumer.setMessageListener(new MessageListener() {
                     @Override
                     public void onMessage(final Message message) {