[camel] 02/06: CAMEL-12427: Polished doc

2018-04-12 Thread davsclaus
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.git

commit c88a07905c0acfdb4fe250df916b11b0f2e578fd
Author: Claus Ibsen 
AuthorDate: Wed Apr 11 16:35:29 2018 +0200

CAMEL-12427: Polished doc
---
 .../src/main/docs/netty4-component.adoc| 250 +
 1 file changed, 110 insertions(+), 140 deletions(-)

diff --git a/components/camel-netty4/src/main/docs/netty4-component.adoc 
b/components/camel-netty4/src/main/docs/netty4-component.adoc
index b65ee80..dfde1c7 100644
--- a/components/camel-netty4/src/main/docs/netty4-component.adoc
+++ b/components/camel-netty4/src/main/docs/netty4-component.adoc
@@ -22,24 +22,24 @@ Maven users will need to add the following dependency to 
their `pom.xml`
 for this component:
 
 [source,xml]
-
+
 
 org.apache.camel
 camel-netty4
 x.x.x
 
 
-
+
 
-### URI format
+=== URI format
 
 The URI scheme for a netty component is as follows
 
-[source,java]
-
+[source,text]
+
 netty4:tcp://localhost:9[?options]
 netty4:udp://remotehost:9/[?options]
-
+
 
 This component supports producer and consumer endpoints for both TCP and
 UDP.
@@ -47,11 +47,7 @@ UDP.
 You can append query options to the URI in the following format,
 `?option=value&option=value&...`
 
-### Options
-
-
-
-
+=== Options
 
 // component options: START
 The Netty4 component supports 5 options which are listed below.
@@ -70,15 +66,6 @@ The Netty4 component supports 5 options which are listed 
below.
 // component options: END
 
 
-
-
-
-
-
-
-
-
-
 // endpoint options: START
 The Netty4 endpoint is configured using URI syntax:
 
@@ -133,9 +120,9 @@ with the following path and query parameters:
 | *connectTimeout* (producer) | Time to wait for a socket connection to be 
available. Value is in millis. | 1 | int
 | *requestTimeout* (producer) | Allows to use a timeout for the Netty producer 
when calling a remote server. By default no timeout is in use. The value is in 
milli seconds, so eg 3 is 30 seconds. The requestTimeout is using Netty's 
ReadTimeoutHandler to trigger the timeout. |  | long
 | *clientInitializerFactory* (producer) | To use a custom 
ClientInitializerFactory |  | ClientInitializer Factory
-| *correlationManager* (producer) | To use a custom correlation manager to 
manage how request and reply messages are mapped when using request/reply with 
the netty producer. This should only be used if you have a way to map requests 
together with replies such as if there is correlation ids in both the request 
and reply messages. This can be used if you want to multiplex concurrent 
messages on the same channel (aka connection) in netty. When doing this you 
must have a way to correlate the [...]
+| *correlationManager* (producer) | To use a custom correlation manager to 
manage how request and reply messages are mapped when using request/reply with 
the netty producer. This should only be used if you have a way to map requests 
together with replies such as if there is correlation ids in both the request 
and reply messages. This can be used if you want to multiplex concurrent 
messages on the same channel (aka connection) in netty. When doing this you 
must have a way to correlate the [...]
 | *lazyChannelCreation* (producer) | Channels can be lazily created to avoid 
exceptions, if the remote server is not up and running when the Camel producer 
is started. | true | boolean
-| *producerPoolEnabled* (producer) | Whether producer pool is enabled or not. 
Important: If you turn this off then a single shared connection is used for the 
producer, also if you are doing request/reply. That means there is a potential 
issue with interleaved responses if replies comes back out-of-order. Therefore 
you need to have a correlation id in both the request and reply messages so you 
can properly correlate the replies to the Camel callback that is responsible 
for continue proces [...]
+| *producerPoolEnabled* (producer) | Whether producer pool is enabled or not. 
Important: Do not turn this off, as the pooling is needed for handling 
concurrency and reliable request/reply. | true | boolean
 | *producerPoolMaxActive* (producer) | Sets the cap on the number of objects 
that can be allocated by the pool (checked out to clients, or idle awaiting 
checkout) at a given time. Use a negative value for no limit. | -1 | int
 | *producerPoolMaxIdle* (producer) | Sets the cap on the number of idle 
instances in the pool. | 100 | int
 | *producerPoolMinEvictable Idle* (producer) | Sets the minimum amount of time 
(value in millis) an object may sit idle in the pool before it is eligible for 
eviction by the idle object evictor. | 30 | long
@@ 

[camel] 03/06: Polished docs

2018-04-12 Thread davsclaus
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.git

commit f906c1f9bb86e0fa061e7a328dddce32b3672a6a
Author: Claus Ibsen 
AuthorDate: Wed Apr 11 16:46:04 2018 +0200

Polished docs
---
 .../camel-hl7/src/main/docs/hl7-dataformat.adoc| 194 ++---
 1 file changed, 95 insertions(+), 99 deletions(-)

diff --git a/components/camel-hl7/src/main/docs/hl7-dataformat.adoc 
b/components/camel-hl7/src/main/docs/hl7-dataformat.adoc
index 544a751..3ba91fc 100644
--- a/components/camel-hl7/src/main/docs/hl7-dataformat.adoc
+++ b/components/camel-hl7/src/main/docs/hl7-dataformat.adoc
@@ -20,16 +20,16 @@ Maven users will need to add the following dependency to 
their `pom.xml`
 for this component:
 
 [source,xml]
-
+
 
 org.apache.camel
 camel-hl7
 x.x.x
 
 
-
+
 
-### HL7 MLLP protocol
+=== HL7 MLLP protocol
 
 HL7 is often used with the HL7 MLLP protocol, which is a text based TCP
 socket based protocol. This component ships with a Mina and Netty4 Codec
@@ -43,7 +43,7 @@ a HL7 listener service, the <> or
 HL7 MLLP codec can be configured as follows:
 
 [width="100%",cols="10%,10%,80%",options="header",]
-|===
+|===
 |Name |Default Value |Description
 
 |`startByte` |`0x0b` |The start byte spanning the HL7 payload.
@@ -65,17 +65,17 @@ the HL7 message content.
 
 |`convertLFtoCR` |`false` |Will convert `\n` to `\r` (`0x0d`, 13 decimal) as 
HL7 stipulates `\r` as
 segment terminators. The HAPI library requires the use of `\r`.
-|===
+|===
 
- Exposing an HL7 listener using Mina
+ Exposing an HL7 listener using Mina
 
 In the Spring XML file, we configure a mina2 endpoint to listen for HL7
 requests using TCP on port ``:
 
 [source,xml]

-

+
+
+
 
 *sync=true* indicates that this listener is synchronous and therefore
 will return a HL7 response to the caller. The HL7 codec is setup with
@@ -84,34 +84,35 @@ could be named `mygreatcodecforhl7` or whatever. The codec 
is also set
 up in the Spring XML file:
 
 [source,xml]
-
-
-
-
-
+
+
+
+
+
 
 The endpoint *hl7MinaLlistener* can then be used in a route as a
 consumer, as this Java DSL example illustrates:
 
 [source,java]
-
-from("hl7MinaListener").beanRef("patientLookupService");
-
+
+from("hl7MinaListener")
+  .bean("patientLookupService");
+
 
 This is a very simple route that will listen for HL7 and route it to a
 service named *patientLookupService*. This is also Spring bean ID,
 configured in the Spring XML as:
 
 [source,xml]

-

+
+
+
 
 The business logic can be implemented in POJO classes that do not depend
 on Camel, as shown here:
 
 [source,java]
-
+
 import ca.uhn.hl7v2.HL7Exception;
 import ca.uhn.hl7v2.model.Message;
 import ca.uhn.hl7v2.model.v24.segment.QRD;
@@ -125,17 +126,17 @@ public class PatientLookupService {
 Message response = ... create and set response data
 return response
 }
-
+
 
- Exposing an HL7 listener using Netty (available from Camel 2.15 onwards)
+ Exposing an HL7 listener using Netty (available from Camel 2.15 onwards)
 
 In the Spring XML file, we configure a netty4 endpoint to listen for HL7
 requests using TCP on port ``:
 
 [source,xml]
--
-
--
+
+
+
 
 *sync=true* indicates that this listener is synchronous and therefore
 will return a HL7 response to the caller. The HL7 codec is setup with
@@ -144,20 +145,21 @@ and `hl7decoder` are just bean IDs, so they could be 
named differently.
 

[camel] 06/06: CAMEL-12427: camel-netty4 - Add SPI to plugin custom correlation state for request/reply in producer

2018-04-12 Thread davsclaus
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.git

commit 243549faf3f5d7db641521a43d87f24ad2c27ea1
Author: Claus Ibsen 
AuthorDate: Thu Apr 12 10:11:24 2018 +0200

CAMEL-12427: camel-netty4 - Add SPI to plugin custom correlation state for 
request/reply in producer
---
 components/camel-netty4/src/main/docs/netty4-component.adoc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/components/camel-netty4/src/main/docs/netty4-component.adoc 
b/components/camel-netty4/src/main/docs/netty4-component.adoc
index c190ca0..21f5713 100644
--- a/components/camel-netty4/src/main/docs/netty4-component.adoc
+++ b/components/camel-netty4/src/main/docs/netty4-component.adoc
@@ -684,7 +684,7 @@ To do this you need to implement 
`NettyCamelStateCorrelationManager` as correlat
 it via the `correlationManager=#myManager` option.
 
 You can find an example with the Apache Camel source code in the examples 
directory
-under the `camel-netty-custom-correlation-example` directory.
+under the `camel-example-netty-custom-correlation` directory.
 
 === See Also
 

-- 
To stop receiving notification emails like this one, please contact
davscl...@apache.org.


[camel] branch master updated (359aa13 -> 243549f)

2018-04-12 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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


from 359aa13  Use the same version of Metrics for Camel-CassandraQL too
 new 6f99ee6  CAMEL-12427: camel-netty4 - Add SPI to plugin custom 
correlation state for request/reply in producer
 new c88a079  CAMEL-12427: Polished doc
 new f906c1f  Polished docs
 new 6b341bc  CAMEL-12427: camel-netty4 - Add SPI to plugin custom 
correlation state for request/reply in producer
 new 484cd10  CAMEL-12427: add example for using custom correlation manager 
and codec with netty
 new 243549f  CAMEL-12427: camel-netty4 - Add SPI to plugin custom 
correlation state for request/reply in producer

The 6 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:
 .../camel-hl7/src/main/docs/hl7-dataformat.adoc| 194 ---
 .../src/main/docs/netty4-component.adoc| 269 ++---
 .../camel/component/netty4/NettyConfiguration.java |  11 +-
 .../camel-example-netty-custom-correlation/pom.xml | 109 +
 .../readme.adoc|  30 +++
 .../org/apache/camel/example/netty/MyClient.java   |  74 ++
 .../apache/camel/example/netty/MyCodecDecoder.java |  72 ++
 .../camel/example/netty/MyCodecDecoderFactory.java |  28 +++
 .../apache/camel/example/netty/MyCodecEncoder.java |  50 
 .../camel/example/netty/MyCodecEncoderFactory.java |  28 +++
 .../camel/example/netty/MyCorrelationManager.java  |  72 ++
 .../org/apache/camel/example/netty/MyServer.java   |  53 
 .../src/main}/resources/log4j2.properties  |   0
 examples/pom.xml   |   1 +
 .../springboot/NettyComponentConfiguration.java|  17 +-
 15 files changed, 766 insertions(+), 242 deletions(-)
 create mode 100644 examples/camel-example-netty-custom-correlation/pom.xml
 create mode 100644 examples/camel-example-netty-custom-correlation/readme.adoc
 create mode 100644 
examples/camel-example-netty-custom-correlation/src/main/java/org/apache/camel/example/netty/MyClient.java
 create mode 100644 
examples/camel-example-netty-custom-correlation/src/main/java/org/apache/camel/example/netty/MyCodecDecoder.java
 create mode 100644 
examples/camel-example-netty-custom-correlation/src/main/java/org/apache/camel/example/netty/MyCodecDecoderFactory.java
 create mode 100644 
examples/camel-example-netty-custom-correlation/src/main/java/org/apache/camel/example/netty/MyCodecEncoder.java
 create mode 100644 
examples/camel-example-netty-custom-correlation/src/main/java/org/apache/camel/example/netty/MyCodecEncoderFactory.java
 create mode 100644 
examples/camel-example-netty-custom-correlation/src/main/java/org/apache/camel/example/netty/MyCorrelationManager.java
 create mode 100644 
examples/camel-example-netty-custom-correlation/src/main/java/org/apache/camel/example/netty/MyServer.java
 copy {tests/camel-itest-osgi/src/test => 
examples/camel-example-netty-custom-correlation/src/main}/resources/log4j2.properties
 (100%)

-- 
To stop receiving notification emails like this one, please contact
davscl...@apache.org.


[camel] 01/06: CAMEL-12427: camel-netty4 - Add SPI to plugin custom correlation state for request/reply in producer

2018-04-12 Thread davsclaus
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.git

commit 6f99ee6c48c757414aa5b6aaf29556a6b81115ac
Author: Claus Ibsen 
AuthorDate: Wed Apr 11 16:29:31 2018 +0200

CAMEL-12427: camel-netty4 - Add SPI to plugin custom correlation state for 
request/reply in producer
---
 .../camel-netty4/src/main/docs/netty4-component.adoc|  4 ++--
 .../camel/component/netty4/NettyConfiguration.java  | 11 ++-
 .../netty4/springboot/NettyComponentConfiguration.java  | 17 ++---
 3 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/components/camel-netty4/src/main/docs/netty4-component.adoc 
b/components/camel-netty4/src/main/docs/netty4-component.adoc
index 4d8c61e..b65ee80 100644
--- a/components/camel-netty4/src/main/docs/netty4-component.adoc
+++ b/components/camel-netty4/src/main/docs/netty4-component.adoc
@@ -133,9 +133,9 @@ with the following path and query parameters:
 | *connectTimeout* (producer) | Time to wait for a socket connection to be 
available. Value is in millis. | 1 | int
 | *requestTimeout* (producer) | Allows to use a timeout for the Netty producer 
when calling a remote server. By default no timeout is in use. The value is in 
milli seconds, so eg 3 is 30 seconds. The requestTimeout is using Netty's 
ReadTimeoutHandler to trigger the timeout. |  | long
 | *clientInitializerFactory* (producer) | To use a custom 
ClientInitializerFactory |  | ClientInitializer Factory
-| *correlationManager* (producer) | To use a custom correlation manager to 
manage how request and reply messages are mapped when using request/reply with 
the netty producer. This should only be used if you have a way to map requests 
together with replies such as if there is correlation ids in both the request 
and reply messages. This can be used if you want to multiplex concurrent 
messages on the same channel (aka connection) in netty. When doing this you 
must have a way to correlate the [...]
+| *correlationManager* (producer) | To use a custom correlation manager to 
manage how request and reply messages are mapped when using request/reply with 
the netty producer. This should only be used if you have a way to map requests 
together with replies such as if there is correlation ids in both the request 
and reply messages. This can be used if you want to multiplex concurrent 
messages on the same channel (aka connection) in netty. When doing this you 
must have a way to correlate the [...]
 | *lazyChannelCreation* (producer) | Channels can be lazily created to avoid 
exceptions, if the remote server is not up and running when the Camel producer 
is started. | true | boolean
-| *producerPoolEnabled* (producer) | Whether producer pool is enabled or not. 
Important: Do not turn this off, as the pooling is needed for handling 
concurrency and reliable request/reply. | true | boolean
+| *producerPoolEnabled* (producer) | Whether producer pool is enabled or not. 
Important: If you turn this off then a single shared connection is used for the 
producer, also if you are doing request/reply. That means there is a potential 
issue with interleaved responses if replies comes back out-of-order. Therefore 
you need to have a correlation id in both the request and reply messages so you 
can properly correlate the replies to the Camel callback that is responsible 
for continue proces [...]
 | *producerPoolMaxActive* (producer) | Sets the cap on the number of objects 
that can be allocated by the pool (checked out to clients, or idle awaiting 
checkout) at a given time. Use a negative value for no limit. | -1 | int
 | *producerPoolMaxIdle* (producer) | Sets the cap on the number of idle 
instances in the pool. | 100 | int
 | *producerPoolMinEvictable Idle* (producer) | Sets the minimum amount of time 
(value in millis) an object may sit idle in the pool before it is eligible for 
eviction by the idle object evictor. | 30 | long
diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java
index 98e9298..a2086ef 100644
--- 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java
+++ 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java
@@ -589,7 +589,14 @@ public class NettyConfiguration extends 
NettyServerBootstrapConfiguration implem
 
 /**
  * Whether producer pool is enabled or not.
- * Important: Do not turn this off, as the pooling is needed for handling 
concurrency and reliable request/reply.
+ *
+ * Important: If you turn this off then a single shared connection is used 
for the producer, also if you are doing request/reply.
+ * That means there is a potential issue with interleaved responses if 
replies comes back

[camel] 05/06: CAMEL-12427: add example for using custom correlation manager and codec with netty

2018-04-12 Thread davsclaus
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.git

commit 484cd1045dd60858c4a3713191e56155dac57715
Author: Claus Ibsen 
AuthorDate: Thu Apr 12 10:11:07 2018 +0200

CAMEL-12427: add example for using custom correlation manager and codec 
with netty
---
 .../camel-example-netty-custom-correlation/pom.xml | 109 +
 .../readme.adoc|  30 ++
 .../org/apache/camel/example/netty/MyClient.java   |  74 ++
 .../apache/camel/example/netty/MyCodecDecoder.java |  72 ++
 .../camel/example/netty/MyCodecDecoderFactory.java |  28 ++
 .../apache/camel/example/netty/MyCodecEncoder.java |  50 ++
 .../camel/example/netty/MyCodecEncoderFactory.java |  28 ++
 .../camel/example/netty/MyCorrelationManager.java  |  72 ++
 .../org/apache/camel/example/netty/MyServer.java   |  53 ++
 .../src/main/resources/log4j2.properties   |  23 +
 examples/pom.xml   |   1 +
 11 files changed, 540 insertions(+)

diff --git a/examples/camel-example-netty-custom-correlation/pom.xml 
b/examples/camel-example-netty-custom-correlation/pom.xml
new file mode 100644
index 000..7a18b35
--- /dev/null
+++ b/examples/camel-example-netty-custom-correlation/pom.xml
@@ -0,0 +1,109 @@
+
+
+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 
http://maven.apache.org/maven-v4_0_0.xsd";>
+
+  4.0.0
+
+  
+org.apache.camel.example
+examples
+2.22.0-SNAPSHOT
+  
+
+  camel-example-netty-custom-correlation
+  jar
+  Camel :: Example :: Netty Custom Correlation
+  An example for showing Camel Netty with custom codec and 
correlation id
+
+  
+Messaging
+  
+
+  
+
+
+  org.apache.camel
+  camel-core
+
+
+  org.apache.camel
+  camel-netty4
+
+
+
+
+  org.apache.logging.log4j
+  log4j-api
+
+
+  org.apache.logging.log4j
+  log4j-core
+
+
+  org.apache.logging.log4j
+  log4j-slf4j-impl
+
+
+  org.apache.logging.log4j
+  log4j-jul
+
+
+  
+
+  
+
+
+  client
+  
+
+  
+  
+org.codehaus.mojo
+exec-maven-plugin
+
+  org.apache.camel.example.netty.MyClient
+  false
+
+  
+
+  
+
+
+
+  server
+  
+
+  
+  
+org.codehaus.mojo
+exec-maven-plugin
+
+  org.apache.camel.example.netty.MyServer
+  false
+
+  
+
+  
+
+
+  
+
+
diff --git a/examples/camel-example-netty-custom-correlation/readme.adoc 
b/examples/camel-example-netty-custom-correlation/readme.adoc
new file mode 100644
index 000..17d215c
--- /dev/null
+++ b/examples/camel-example-netty-custom-correlation/readme.adoc
@@ -0,0 +1,30 @@
+== Camel Example Netty Custom Correlation
+
+This example shows how to use TCP communication with Netty using a custom codec
+to encode and decode the data over the wire.
+
+The example also uses a single shared connection between the client and the 
server
+to multiplex concurrent messages over the same connection. A custom 
correlation manager
+is implemented to be able to correlate the request and response message pairs 
so you
+do not mix-data to wrong replies.
+
+=== How to run
+
+You can run this example using two JVMs.
+
+To start the server run:
+
+mvn compile exec:java -P server
+
+To start the client run:
+
+mvn compile exec:java -P client
+
+In the client output you should see it logs request/response pairs.
+For requests that contains the word `beer` is delayed on the server side, and 
you
+should notice that its corresponding reply is correlated correclty to its 
beloing request thread.
+Also the messages can be inter-leaved when some messages are faster than 
others.
+
+=== More information
+
+You can find more information about Apache Camel at the website: 
http://camel.apache.org/
diff --git 
a/examples/camel-example-netty-custom-correlation/src/main/java/org/apache/camel/example/netty/MyClient.java
 
b/examples/camel-example-netty-custom-correlation/src/main/java/org/apache/camel/example/netty/MyClient.java
new file mode 100644
index 000..6c69fb9
--- /dev/null
+++ 
b/examples/camel-example-netty-custom-correlation/src/main/java/org/apache/camel/example/netty/MyClient.java
@@ -0,0 +1,74 @@
+/**
+ * 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 "Lice

[camel] 04/06: CAMEL-12427: camel-netty4 - Add SPI to plugin custom correlation state for request/reply in producer

2018-04-12 Thread davsclaus
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.git

commit 6b341bcd931ae8c6c7ca8d2832f7ae744300cd5c
Author: Claus Ibsen 
AuthorDate: Wed Apr 11 16:52:39 2018 +0200

CAMEL-12427: camel-netty4 - Add SPI to plugin custom correlation state for 
request/reply in producer
---
 .../src/main/docs/netty4-component.adoc| 23 +-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/components/camel-netty4/src/main/docs/netty4-component.adoc 
b/components/camel-netty4/src/main/docs/netty4-component.adoc
index dfde1c7..c190ca0 100644
--- a/components/camel-netty4/src/main/docs/netty4-component.adoc
+++ b/components/camel-netty4/src/main/docs/netty4-component.adoc
@@ -663,7 +663,28 @@ And if we have another route we can refer to the shared 
worker pool:
 
 
 
-... and so forth.
+and so forth.
+
+=== Multiplexing concurrent messages over a single connection with 
request/reply
+
+When using Netty for request/reply messaging via the netty producer then by 
default each
+message is sent via a non-shared connection (pooled). This ensures that 
replies are
+automatic being able to map to the correct request thread for further routing 
in Camel.
+In other words correlation between request/reply messages happens 
out-of-the-box because
+the replies comes back on the same connection that was used for sending the 
request;
+and this connection is not shared with others. When the response comes back, 
the connection
+is returned back to the connection pool, where it can be reused by others.
+
+However if you want to multiplex concurrent request/responses on a single 
shared connection,
+then you need to turn off the connection pooling by setting 
`producerPoolEnabled=false`.
+Now this means there is a potential issue with interleaved responses if 
replies comes back out-of-order.
+Therefore you need to have a correlation id in both the request and reply 
messages so you can properly
+correlate the replies to the Camel callback that is responsible for continue 
processing the message in Camel.
+To do this you need to implement `NettyCamelStateCorrelationManager` as 
correlation manager and configure
+it via the `correlationManager=#myManager` option.
+
+You can find an example with the Apache Camel source code in the examples 
directory
+under the `camel-netty-custom-correlation-example` directory.
 
 === See Also
 

-- 
To stop receiving notification emails like this one, please contact
davscl...@apache.org.


[camel] branch camel-2.21.x updated: CAMEL-12427: camel-netty4 - Add SPI to plugin custom correlation state for request/reply in producer

2018-04-12 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/camel-2.21.x by this push:
 new 715a242  CAMEL-12427: camel-netty4 - Add SPI to plugin custom 
correlation state for request/reply in producer
715a242 is described below

commit 715a24254bbf9f1e99d4c84a337bebd6b8c352e5
Author: Claus Ibsen 
AuthorDate: Thu Apr 12 10:48:05 2018 +0200

CAMEL-12427: camel-netty4 - Add SPI to plugin custom correlation state for 
request/reply in producer
---
 .../camel-hl7/src/main/docs/hl7-dataformat.adoc| 194 ---
 .../src/main/docs/netty4-http-component.adoc   |   2 +-
 .../src/main/docs/netty4-component.adoc| 270 ++---
 .../netty4/DefaultClientInitializerFactory.java|   1 -
 .../netty4/NettyCamelStateCorrelationManager.java  |   8 +-
 .../camel/component/netty4/NettyConfiguration.java |  11 +-
 .../camel/component/netty4/NettyProducer.java  |   2 +-
 .../springboot/NettyComponentConfiguration.java|  17 +-
 8 files changed, 257 insertions(+), 248 deletions(-)

diff --git a/components/camel-hl7/src/main/docs/hl7-dataformat.adoc 
b/components/camel-hl7/src/main/docs/hl7-dataformat.adoc
index 544a751..3ba91fc 100644
--- a/components/camel-hl7/src/main/docs/hl7-dataformat.adoc
+++ b/components/camel-hl7/src/main/docs/hl7-dataformat.adoc
@@ -20,16 +20,16 @@ Maven users will need to add the following dependency to 
their `pom.xml`
 for this component:
 
 [source,xml]
-
+
 
 org.apache.camel
 camel-hl7
 x.x.x
 
 
-
+
 
-### HL7 MLLP protocol
+=== HL7 MLLP protocol
 
 HL7 is often used with the HL7 MLLP protocol, which is a text based TCP
 socket based protocol. This component ships with a Mina and Netty4 Codec
@@ -43,7 +43,7 @@ a HL7 listener service, the <> or
 HL7 MLLP codec can be configured as follows:
 
 [width="100%",cols="10%,10%,80%",options="header",]
-|===
+|===
 |Name |Default Value |Description
 
 |`startByte` |`0x0b` |The start byte spanning the HL7 payload.
@@ -65,17 +65,17 @@ the HL7 message content.
 
 |`convertLFtoCR` |`false` |Will convert `\n` to `\r` (`0x0d`, 13 decimal) as 
HL7 stipulates `\r` as
 segment terminators. The HAPI library requires the use of `\r`.
-|===
+|===
 
- Exposing an HL7 listener using Mina
+ Exposing an HL7 listener using Mina
 
 In the Spring XML file, we configure a mina2 endpoint to listen for HL7
 requests using TCP on port ``:
 
 [source,xml]

-

+
+
+
 
 *sync=true* indicates that this listener is synchronous and therefore
 will return a HL7 response to the caller. The HL7 codec is setup with
@@ -84,34 +84,35 @@ could be named `mygreatcodecforhl7` or whatever. The codec 
is also set
 up in the Spring XML file:
 
 [source,xml]
-
-
-
-
-
+
+
+
+
+
 
 The endpoint *hl7MinaLlistener* can then be used in a route as a
 consumer, as this Java DSL example illustrates:
 
 [source,java]
-
-from("hl7MinaListener").beanRef("patientLookupService");
-
+
+from("hl7MinaListener")
+  .bean("patientLookupService");
+
 
 This is a very simple route that will listen for HL7 and route it to a
 service named *patientLookupService*. This is also Spring bean ID,
 configured in the Spring XML as:
 
 [source,xml]

-

+
+
+
 
 The business logic can be implemented in POJO classes that do not depend
 on Camel, as shown here:
 
 [source,java]
-
+
 import ca.uhn.hl7v2.HL7Exception;
 import ca.uhn.hl7v2.model.Message;
 import ca.uhn.hl7v2.model.v24.segment.QRD;
@@ -125,17 +126,17 @@ public class PatientLookupService {
 Message response = ... create and set response data
 return response
 }
-
+
 
- Exposing an HL7 listener using Netty (ava

[camel] branch camel-2.21.x updated: CAMEL-12435: camel-netty4 - Shared connection pool should re-create connection if its no longer valid

2018-04-12 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/camel-2.21.x by this push:
 new 59248db  CAMEL-12435: camel-netty4 - Shared connection pool should 
re-create connection if its no longer valid
59248db is described below

commit 59248dbff9f4f334780c9bf3d2e8310fca2b3873
Author: Claus Ibsen 
AuthorDate: Thu Apr 12 13:46:15 2018 +0200

CAMEL-12435: camel-netty4 - Shared connection pool should re-create 
connection if its no longer valid
---
 .../apache/camel/component/netty4/SharedSingletonObjectPool.java   | 7 +++
 1 file changed, 7 insertions(+)

diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SharedSingletonObjectPool.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SharedSingletonObjectPool.java
index 9121838..b7408bb 100644
--- 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SharedSingletonObjectPool.java
+++ 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SharedSingletonObjectPool.java
@@ -38,6 +38,13 @@ public class SharedSingletonObjectPool implements 
ObjectPool {
 
 @Override
 public synchronized T borrowObject() throws Exception, 
NoSuchElementException, IllegalStateException {
+if (t != null) {
+// ensure the object is validate before we borrow it
+if (!factory.validateObject(t)) {
+invalidateObject(t);
+t = null;
+}
+}
 if (t == null) {
 t = factory.makeObject();
 }

-- 
To stop receiving notification emails like this one, please contact
davscl...@apache.org.


[camel] branch master updated: CAMEL-12435: camel-netty4 - Shared connection pool should re-create connection if its no longer valid

2018-04-12 Thread davsclaus
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.git


The following commit(s) were added to refs/heads/master by this push:
 new e6304d1  CAMEL-12435: camel-netty4 - Shared connection pool should 
re-create connection if its no longer valid
e6304d1 is described below

commit e6304d148b64e0e9a352243483b1ff72f690f6be
Author: Claus Ibsen 
AuthorDate: Thu Apr 12 13:46:15 2018 +0200

CAMEL-12435: camel-netty4 - Shared connection pool should re-create 
connection if its no longer valid
---
 .../apache/camel/component/netty4/SharedSingletonObjectPool.java   | 7 +++
 1 file changed, 7 insertions(+)

diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SharedSingletonObjectPool.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SharedSingletonObjectPool.java
index 9121838..b7408bb 100644
--- 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SharedSingletonObjectPool.java
+++ 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SharedSingletonObjectPool.java
@@ -38,6 +38,13 @@ public class SharedSingletonObjectPool implements 
ObjectPool {
 
 @Override
 public synchronized T borrowObject() throws Exception, 
NoSuchElementException, IllegalStateException {
+if (t != null) {
+// ensure the object is validate before we borrow it
+if (!factory.validateObject(t)) {
+invalidateObject(t);
+t = null;
+}
+}
 if (t == null) {
 t = factory.makeObject();
 }

-- 
To stop receiving notification emails like this one, please contact
davscl...@apache.org.


[camel] branch camel-2.21.x updated (59248db -> ac3466a)

2018-04-12 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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


from 59248db  CAMEL-12435: camel-netty4 - Shared connection pool should 
re-create connection if its no longer valid
 new ea8040a  CAMEL-12435: camel-netty4 - Shared connection pool should 
re-create connection if its no longer valid
 new ac3466a  CAMEL-12438: camel-netty4 - Add timeout support for SPI 
correlation manager

The 2 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:
 .../src/main/docs/netty4-component.adoc|   5 +-
 .../camel/component/netty4/NettyConfiguration.java |   3 +
 .../camel/component/netty4/NettyProducer.java  |   8 +
 .../netty4/SharedSingletonObjectPool.java  |   4 +
 .../netty4/TimeoutCorrelationManagerSupport.java   | 243 +
 .../springboot/NettyComponentConfiguration.java|   5 +
 6 files changed, 267 insertions(+), 1 deletion(-)
 create mode 100644 
components/camel-netty4/src/main/java/org/apache/camel/component/netty4/TimeoutCorrelationManagerSupport.java

-- 
To stop receiving notification emails like this one, please contact
davscl...@apache.org.


[camel] 01/02: CAMEL-12435: camel-netty4 - Shared connection pool should re-create connection if its no longer valid

2018-04-12 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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

commit ea8040a0db52b8b535ad0698f82df6bc37625b09
Author: Claus Ibsen 
AuthorDate: Thu Apr 12 14:10:39 2018 +0200

CAMEL-12435: camel-netty4 - Shared connection pool should re-create 
connection if its no longer valid
---
 .../org/apache/camel/component/netty4/SharedSingletonObjectPool.java  | 4 
 1 file changed, 4 insertions(+)

diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SharedSingletonObjectPool.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SharedSingletonObjectPool.java
index b7408bb..ebfb4ef 100644
--- 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SharedSingletonObjectPool.java
+++ 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/SharedSingletonObjectPool.java
@@ -20,6 +20,8 @@ import java.util.NoSuchElementException;
 
 import org.apache.commons.pool.ObjectPool;
 import org.apache.commons.pool.PoolableObjectFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * An {@link org.apache.commons.pool.ObjectPool} that uses a single shared 
instance.
@@ -29,6 +31,7 @@ import org.apache.commons.pool.PoolableObjectFactory;
  */
 public class SharedSingletonObjectPool implements ObjectPool {
 
+private static final Logger LOG = 
LoggerFactory.getLogger(SharedSingletonObjectPool.class);
 private final PoolableObjectFactory factory;
 private volatile T t;
 
@@ -42,6 +45,7 @@ public class SharedSingletonObjectPool implements 
ObjectPool {
 // ensure the object is validate before we borrow it
 if (!factory.validateObject(t)) {
 invalidateObject(t);
+LOG.info("Recreating new connection as current connection is 
invalid: {}", t);
 t = null;
 }
 }

-- 
To stop receiving notification emails like this one, please contact
davscl...@apache.org.


[camel] 02/02: CAMEL-12438: camel-netty4 - Add timeout support for SPI correlation manager

2018-04-12 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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

commit ac3466a867836fd774e911fb0f2583685092af83
Author: Claus Ibsen 
AuthorDate: Thu Apr 12 15:06:49 2018 +0200

CAMEL-12438: camel-netty4 - Add timeout support for SPI correlation manager
---
 .../src/main/docs/netty4-component.adoc|   5 +-
 .../camel/component/netty4/NettyConfiguration.java |   3 +
 .../camel/component/netty4/NettyProducer.java  |   8 +
 .../netty4/TimeoutCorrelationManagerSupport.java   | 243 +
 .../springboot/NettyComponentConfiguration.java|   5 +
 5 files changed, 263 insertions(+), 1 deletion(-)

diff --git a/components/camel-netty4/src/main/docs/netty4-component.adoc 
b/components/camel-netty4/src/main/docs/netty4-component.adoc
index f66a582..28d961e 100644
--- a/components/camel-netty4/src/main/docs/netty4-component.adoc
+++ b/components/camel-netty4/src/main/docs/netty4-component.adoc
@@ -120,7 +120,7 @@ with the following path and query parameters:
 | *connectTimeout* (producer) | Time to wait for a socket connection to be 
available. Value is in millis. | 1 | int
 | *requestTimeout* (producer) | Allows to use a timeout for the Netty producer 
when calling a remote server. By default no timeout is in use. The value is in 
milli seconds, so eg 3 is 30 seconds. The requestTimeout is using Netty's 
ReadTimeoutHandler to trigger the timeout. |  | long
 | *clientInitializerFactory* (producer) | To use a custom 
ClientInitializerFactory |  | ClientInitializer Factory
-| *correlationManager* (producer) | To use a custom correlation manager to 
manage how request and reply messages are mapped when using request/reply with 
the netty producer. This should only be used if you have a way to map requests 
together with replies such as if there is correlation ids in both the request 
and reply messages. This can be used if you want to multiplex concurrent 
messages on the same channel (aka connection) in netty. When doing this you 
must have a way to correlate the [...]
+| *correlationManager* (producer) | To use a custom correlation manager to 
manage how request and reply messages are mapped when using request/reply with 
the netty producer. This should only be used if you have a way to map requests 
together with replies such as if there is correlation ids in both the request 
and reply messages. This can be used if you want to multiplex concurrent 
messages on the same channel (aka connection) in netty. When doing this you 
must have a way to correlate the [...]
 | *lazyChannelCreation* (producer) | Channels can be lazily created to avoid 
exceptions, if the remote server is not up and running when the Camel producer 
is started. | true | boolean
 | *producerPoolEnabled* (producer) | Whether producer pool is enabled or not. 
Important: If you turn this off then a single shared connection is used for the 
producer, also if you are doing request/reply. That means there is a potential 
issue with interleaved responses if replies comes back out-of-order. Therefore 
you need to have a correlation id in both the request and reply messages so you 
can properly correlate the replies to the Camel callback that is responsible 
for continue proces [...]
 | *producerPoolMaxActive* (producer) | Sets the cap on the number of objects 
that can be allocated by the pool (checked out to clients, or idle awaiting 
checkout) at a given time. Use a negative value for no limit. | -1 | int
@@ -683,6 +683,9 @@ correlate the replies to the Camel callback that is 
responsible for continue pro
 To do this you need to implement `NettyCamelStateCorrelationManager` as 
correlation manager and configure
 it via the `correlationManager=#myManager` option.
 
+NOTE: We recommend extending the `TimeoutCorrelationManagerSupport` when you 
build custom correlation managers.
+This provides support for timeout and other complexities you otherwise would 
need to implement as well.
+
 === See Also
 
 * <>
diff --git 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java
 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java
index a2086ef..32cf5dc 100644
--- 
a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java
+++ 
b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyConfiguration.java
@@ -675,6 +675,9 @@ public class NettyConfiguration extends 
NettyServerBootstrapConfiguration implem
  * this you must have a way to correlate the request and reply messages so 
you can store the right reply on the inflight Camel Exchange before
  * its continued routed.
  * 
+ * We recommend extending the {@link TimeoutCorrelationManagerSupport} 
when you build custom correlation managers.
+ * This provides support for timeout and other com

[camel] branch camel-2.21.x updated: Added test for custom component which uses a backing service which furthermore sends data to a further Camel route asynchronously. As the processing route was a si

2018-04-12 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/camel-2.21.x by this push:
 new e5fa508  Added test for custom component which uses a backing service 
which furthermore sends data to a further Camel route asynchronously. As the 
processing route was a single consumer thread it couldn't process new tasks 
issued to it till the further task was finished leading to XRay emitting the 
segment preemptively as it wasn't aware that some stuff from the asynchronous 
route, which wasn't processed yet, belong to it. Later on, when the 
asynchronous code was executed an Alre [...]
e5fa508 is described below

commit e5fa508b38a4d6fb7d8742a755a091b94bb3762d
Author: Roman Vottner 
AuthorDate: Wed Apr 11 17:19:06 2018 +0200

Added test for custom component which uses a backing service which 
furthermore sends data to a further Camel route asynchronously. As the 
processing route was a single consumer thread it couldn't process new tasks 
issued to it till the further task was finished leading to XRay emitting the 
segment preemptively as it wasn't aware that some stuff from the asynchronous 
route, which wasn't processed yet, belong to it. Later on, when the 
asynchronous code was executed an AlreadyEmittedExce [...]
Added also notify builders to each test case in order to get issues with 
test-timing right. This also has the benefit to get rid of Thread.sleeps(...) 
inside of the tests itself
---
 .../camel/component/aws/xray/XRayTracer.java   |  88 +++
 .../camel/component/aws/xray/ABCRouteTest.java |  11 ++
 .../camel/component/aws/xray/BeanTracingTest.java  |  11 ++
 .../aws/xray/ClientRecipientListRouteTest.java |  11 ++
 .../aws/xray/ComprehensiveTrackingTest.java|   8 +
 .../component/aws/xray/CustomComponentTest.java| 169 +
 .../camel/component/aws/xray/EIPTracingTest.java   |  11 ++
 .../component/aws/xray/ErrorHandlingTest.java  |  11 ++
 .../apache/camel/component/aws/xray/ErrorTest.java |  12 ++
 .../aws/xray/MulticastParallelRouteTest.java   |  16 ++
 .../component/aws/xray/MulticastRouteTest.java |  16 ++
 .../component/aws/xray/Route2ConcurrentTest.java   |   7 +-
 .../component/aws/xray/RouteConcurrentTest.java|   7 +-
 .../aws/xray/SpringAwsXRaySimpleRouteTest.java |   8 +-
 .../apache/camel/component/aws/xray/TestUtils.java |  13 +-
 .../camel/component/aws/xray/TwoService2Test.java  |  13 +-
 .../camel/component/aws/xray/TwoServiceTest.java   |  12 +-
 .../aws/xray/TwoServiceWithExcludeTest.java|  13 +-
 .../aws/xray/bean/ProcessingCamelBean.java |  45 ++
 .../aws/xray/bean/SomeBackingService.java  |  57 +++
 .../aws/xray/component/CommonEndpoints.java|  29 
 .../aws/xray/component/TestXRayComponent.java  |  39 +
 .../aws/xray/component/TestXRayEndpoint.java   |  53 +++
 .../aws/xray/component/TestXRayProducer.java   |  52 +++
 .../services/org/apache/camel/component/xray-test  |   1 +
 25 files changed, 675 insertions(+), 38 deletions(-)

diff --git 
a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/XRayTracer.java
 
b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/XRayTracer.java
index 128d964..e8c1112 100644
--- 
a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/XRayTracer.java
+++ 
b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/XRayTracer.java
@@ -18,7 +18,13 @@ package org.apache.camel.component.aws.xray;
 
 import java.lang.invoke.MethodHandles;
 import java.net.URI;
-import java.util.*;
+import java.util.EventObject;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Optional;
+import java.util.ServiceLoader;
+import java.util.Set;
 
 import com.amazonaws.xray.AWSXRay;
 import com.amazonaws.xray.AWSXRayRecorder;
@@ -26,7 +32,7 @@ import com.amazonaws.xray.entities.Entity;
 import com.amazonaws.xray.entities.Segment;
 import com.amazonaws.xray.entities.Subsegment;
 import com.amazonaws.xray.entities.TraceID;
-
+import com.amazonaws.xray.exceptions.AlreadyEmittedException;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
 import org.apache.camel.Endpoint;
@@ -277,10 +283,15 @@ public class XRayTracer extends ServiceSupport implements 
RoutePolicyFactory, St
 if (sd.getComponent() != null) {
 name = sd.getComponent() + ":" + name;
 }
-Subsegment subsegment = 
AWSXRay.beginSubsegment(sanitizeName(name));
-sd.pre(subsegment, ese.getExchange(), ese.getEndpoint());
-LOG.trace("Creating new subsegment with ID {} and name {}",
-subsegment

[camel] branch master updated: Added test for custom component which uses a backing service which furthermore sends data to a further Camel route asynchronously. As the processing route was a single c

2018-04-12 Thread davsclaus
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.git


The following commit(s) were added to refs/heads/master by this push:
 new a50f558  Added test for custom component which uses a backing service 
which furthermore sends data to a further Camel route asynchronously. As the 
processing route was a single consumer thread it couldn't process new tasks 
issued to it till the further task was finished leading to XRay emitting the 
segment preemptively as it wasn't aware that some stuff from the asynchronous 
route, which wasn't processed yet, belong to it. Later on, when the 
asynchronous code was executed an Alre [...]
a50f558 is described below

commit a50f55848862f529393a5fd0df93f6d29fbb0c42
Author: Roman Vottner 
AuthorDate: Wed Apr 11 17:19:06 2018 +0200

Added test for custom component which uses a backing service which 
furthermore sends data to a further Camel route asynchronously. As the 
processing route was a single consumer thread it couldn't process new tasks 
issued to it till the further task was finished leading to XRay emitting the 
segment preemptively as it wasn't aware that some stuff from the asynchronous 
route, which wasn't processed yet, belong to it. Later on, when the 
asynchronous code was executed an AlreadyEmittedExce [...]
Added also notify builders to each test case in order to get issues with 
test-timing right. This also has the benefit to get rid of Thread.sleeps(...) 
inside of the tests itself
---
 .../camel/component/aws/xray/XRayTracer.java   |  88 +++
 .../camel/component/aws/xray/ABCRouteTest.java |  11 ++
 .../camel/component/aws/xray/BeanTracingTest.java  |  11 ++
 .../aws/xray/ClientRecipientListRouteTest.java |  11 ++
 .../aws/xray/ComprehensiveTrackingTest.java|   8 +
 .../component/aws/xray/CustomComponentTest.java| 169 +
 .../camel/component/aws/xray/EIPTracingTest.java   |  11 ++
 .../component/aws/xray/ErrorHandlingTest.java  |  11 ++
 .../apache/camel/component/aws/xray/ErrorTest.java |  12 ++
 .../aws/xray/MulticastParallelRouteTest.java   |  16 ++
 .../component/aws/xray/MulticastRouteTest.java |  16 ++
 .../component/aws/xray/Route2ConcurrentTest.java   |   7 +-
 .../component/aws/xray/RouteConcurrentTest.java|   7 +-
 .../aws/xray/SpringAwsXRaySimpleRouteTest.java |   8 +-
 .../apache/camel/component/aws/xray/TestUtils.java |  13 +-
 .../camel/component/aws/xray/TwoService2Test.java  |  13 +-
 .../camel/component/aws/xray/TwoServiceTest.java   |  12 +-
 .../aws/xray/TwoServiceWithExcludeTest.java|  13 +-
 .../aws/xray/bean/ProcessingCamelBean.java |  45 ++
 .../aws/xray/bean/SomeBackingService.java  |  57 +++
 .../aws/xray/component/CommonEndpoints.java|  29 
 .../aws/xray/component/TestXRayComponent.java  |  39 +
 .../aws/xray/component/TestXRayEndpoint.java   |  53 +++
 .../aws/xray/component/TestXRayProducer.java   |  52 +++
 .../services/org/apache/camel/component/xray-test  |   1 +
 25 files changed, 675 insertions(+), 38 deletions(-)

diff --git 
a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/XRayTracer.java
 
b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/XRayTracer.java
index 128d964..e8c1112 100644
--- 
a/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/XRayTracer.java
+++ 
b/components/camel-aws-xray/src/main/java/org/apache/camel/component/aws/xray/XRayTracer.java
@@ -18,7 +18,13 @@ package org.apache.camel.component.aws.xray;
 
 import java.lang.invoke.MethodHandles;
 import java.net.URI;
-import java.util.*;
+import java.util.EventObject;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Optional;
+import java.util.ServiceLoader;
+import java.util.Set;
 
 import com.amazonaws.xray.AWSXRay;
 import com.amazonaws.xray.AWSXRayRecorder;
@@ -26,7 +32,7 @@ import com.amazonaws.xray.entities.Entity;
 import com.amazonaws.xray.entities.Segment;
 import com.amazonaws.xray.entities.Subsegment;
 import com.amazonaws.xray.entities.TraceID;
-
+import com.amazonaws.xray.exceptions.AlreadyEmittedException;
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelContextAware;
 import org.apache.camel.Endpoint;
@@ -277,10 +283,15 @@ public class XRayTracer extends ServiceSupport implements 
RoutePolicyFactory, St
 if (sd.getComponent() != null) {
 name = sd.getComponent() + ":" + name;
 }
-Subsegment subsegment = 
AWSXRay.beginSubsegment(sanitizeName(name));
-sd.pre(subsegment, ese.getExchange(), ese.getEndpoint());
-LOG.trace("Creating new subsegment with ID {} and name {}",
-subsegment.getId(), su

[camel] branch master updated: CAMEL-12436: Fix Undertow to extract body message from PATCH request

2018-04-12 Thread davsclaus
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.git


The following commit(s) were added to refs/heads/master by this push:
 new 8079044  CAMEL-12436: Fix Undertow to extract body message from PATCH 
request
8079044 is described below

commit 80790444bda66076e72467d4704a3f8286c7d714
Author: Tomas Turek 
AuthorDate: Wed Apr 11 16:35:46 2018 +0200

CAMEL-12436: Fix Undertow to extract body message from PATCH request
---
 .../undertow/DefaultUndertowHttpBinding.java   |  2 +-
 .../rest/RestUndertowProducerPatchTest.java| 58 ++
 2 files changed, 59 insertions(+), 1 deletion(-)

diff --git 
a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/DefaultUndertowHttpBinding.java
 
b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/DefaultUndertowHttpBinding.java
index 91bd852..ae1f6fe 100644
--- 
a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/DefaultUndertowHttpBinding.java
+++ 
b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/DefaultUndertowHttpBinding.java
@@ -124,7 +124,7 @@ public class DefaultUndertowHttpBinding implements 
UndertowHttpBinding {
 } else {
 //extract body by myself if undertow parser didn't handle and the 
method is allowed to have one
 //body is extracted as byte[] then auto TypeConverter kicks in
-if (Methods.POST.equals(httpExchange.getRequestMethod()) || 
Methods.PUT.equals(httpExchange.getRequestMethod())) {
+if (Methods.POST.equals(httpExchange.getRequestMethod()) || 
Methods.PUT.equals(httpExchange.getRequestMethod()) || 
Methods.PATCH.equals(httpExchange.getRequestMethod())) {
 
result.setBody(readFromChannel(httpExchange.getRequestChannel()));
 } else {
 result.setBody(null);
diff --git 
a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowProducerPatchTest.java
 
b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowProducerPatchTest.java
new file mode 100644
index 000..bfbd59f
--- /dev/null
+++ 
b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowProducerPatchTest.java
@@ -0,0 +1,58 @@
+/**
+ * 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.component.undertow.rest;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.undertow.BaseUndertowTest;
+import org.junit.Test;
+
+public class RestUndertowProducerPatchTest extends BaseUndertowTest {
+
+@Test
+public void testUndertowProducerPatch() throws Exception {
+String body = "Donald Duck";
+String id = "123";
+
+MockEndpoint mock = getMockEndpoint("mock:input");
+mock.message(0).body().isEqualTo(body);
+mock.message(0).header("id").isEqualTo(id);
+
+fluentTemplate.withBody(body).withHeader("id", 
id).to("direct:start").send();
+
+assertMockEndpointsSatisfied();
+}
+
+@Override
+protected RouteBuilder createRouteBuilder() throws Exception {
+return new RouteBuilder() {
+@Override
+public void configure() throws Exception {
+// configure to use localhost with the given port
+
restConfiguration().component("undertow").host("localhost").port(getPort());
+
+from("direct:start")
+.to("rest:patch:users/{id}");
+
+// use the rest DSL to define the rest services
+rest("/users/")
+.patch("{id}")
+.to("mock:input");
+}
+};
+}
+}

-- 
To stop receiving notification emails like this one, please contact
davscl...@apache.org.


[camel] branch master updated: CAMEL-12437 - Ability to define dynamic bucket name for s3 router using standard S3Constants.BUCKET_NAME supplied in header

2018-04-12 Thread acosentino
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new f3a1e69  CAMEL-12437 - Ability to define dynamic bucket name for s3 
router using standard S3Constants.BUCKET_NAME supplied in header
f3a1e69 is described below

commit f3a1e69682b5c660ead1a94ac27c958e056cd15c
Author: Laptseu 
AuthorDate: Thu Apr 12 22:28:46 2018 +1000

CAMEL-12437 - Ability to define dynamic bucket name for s3 router using 
standard S3Constants.BUCKET_NAME supplied in header
---
 .../main/java/org/apache/camel/component/aws/s3/S3Producer.java| 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Producer.java
 
b/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Producer.java
index df6e1c3..2efb990 100644
--- 
a/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Producer.java
+++ 
b/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Producer.java
@@ -228,7 +228,12 @@ public class S3Producer extends DefaultProducer {
 is = new ByteArrayInputStream(baos.toByteArray());
 }
 
-putObjectRequest = new 
PutObjectRequest(getConfiguration().getBucketName(), determineKey(exchange), 
is, objectMetadata);
+String bucketName = 
exchange.getIn().getHeader(S3Constants.BUCKET_NAME, String.class);
+if (bucketName == null){
+LOG.trace("Bucket name is not in header, using default one  
[{}]...", getConfiguration().getBucketName());
+bucketName = getConfiguration().getBucketName();
+}
+putObjectRequest = new PutObjectRequest(bucketName, 
determineKey(exchange), is, objectMetadata);
 
 String storageClass = determineStorageClass(exchange);
 if (storageClass != null) {

-- 
To stop receiving notification emails like this one, please contact
acosent...@apache.org.


[camel] branch camel-2.21.x updated: CAMEL-12436: Fix Undertow to extract body message from PATCH request

2018-04-12 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/camel-2.21.x by this push:
 new 7254457  CAMEL-12436: Fix Undertow to extract body message from PATCH 
request
7254457 is described below

commit 7254457e799dce8e6bb901fdf996bf47d1c8485a
Author: Tomas Turek 
AuthorDate: Wed Apr 11 16:35:46 2018 +0200

CAMEL-12436: Fix Undertow to extract body message from PATCH request
---
 .../undertow/DefaultUndertowHttpBinding.java   |  2 +-
 .../rest/RestUndertowProducerPatchTest.java| 58 ++
 2 files changed, 59 insertions(+), 1 deletion(-)

diff --git 
a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/DefaultUndertowHttpBinding.java
 
b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/DefaultUndertowHttpBinding.java
index 91bd852..ae1f6fe 100644
--- 
a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/DefaultUndertowHttpBinding.java
+++ 
b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/DefaultUndertowHttpBinding.java
@@ -124,7 +124,7 @@ public class DefaultUndertowHttpBinding implements 
UndertowHttpBinding {
 } else {
 //extract body by myself if undertow parser didn't handle and the 
method is allowed to have one
 //body is extracted as byte[] then auto TypeConverter kicks in
-if (Methods.POST.equals(httpExchange.getRequestMethod()) || 
Methods.PUT.equals(httpExchange.getRequestMethod())) {
+if (Methods.POST.equals(httpExchange.getRequestMethod()) || 
Methods.PUT.equals(httpExchange.getRequestMethod()) || 
Methods.PATCH.equals(httpExchange.getRequestMethod())) {
 
result.setBody(readFromChannel(httpExchange.getRequestChannel()));
 } else {
 result.setBody(null);
diff --git 
a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowProducerPatchTest.java
 
b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowProducerPatchTest.java
new file mode 100644
index 000..bfbd59f
--- /dev/null
+++ 
b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowProducerPatchTest.java
@@ -0,0 +1,58 @@
+/**
+ * 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.component.undertow.rest;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.undertow.BaseUndertowTest;
+import org.junit.Test;
+
+public class RestUndertowProducerPatchTest extends BaseUndertowTest {
+
+@Test
+public void testUndertowProducerPatch() throws Exception {
+String body = "Donald Duck";
+String id = "123";
+
+MockEndpoint mock = getMockEndpoint("mock:input");
+mock.message(0).body().isEqualTo(body);
+mock.message(0).header("id").isEqualTo(id);
+
+fluentTemplate.withBody(body).withHeader("id", 
id).to("direct:start").send();
+
+assertMockEndpointsSatisfied();
+}
+
+@Override
+protected RouteBuilder createRouteBuilder() throws Exception {
+return new RouteBuilder() {
+@Override
+public void configure() throws Exception {
+// configure to use localhost with the given port
+
restConfiguration().component("undertow").host("localhost").port(getPort());
+
+from("direct:start")
+.to("rest:patch:users/{id}");
+
+// use the rest DSL to define the rest services
+rest("/users/")
+.patch("{id}")
+.to("mock:input");
+}
+};
+}
+}

-- 
To stop receiving notification emails like this one, please contact
davscl...@apache.org.


[camel] branch camel-2.20.x updated: CAMEL-12436: Fix Undertow to extract body message from PATCH request

2018-04-12 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/camel-2.20.x by this push:
 new 571171d  CAMEL-12436: Fix Undertow to extract body message from PATCH 
request
571171d is described below

commit 571171d8fbb4a56b8c3edb1499fe8cefdc10ab00
Author: Tomas Turek 
AuthorDate: Wed Apr 11 16:35:46 2018 +0200

CAMEL-12436: Fix Undertow to extract body message from PATCH request
---
 .../undertow/DefaultUndertowHttpBinding.java   |  2 +-
 .../rest/RestUndertowProducerPatchTest.java| 58 ++
 2 files changed, 59 insertions(+), 1 deletion(-)

diff --git 
a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/DefaultUndertowHttpBinding.java
 
b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/DefaultUndertowHttpBinding.java
index 91bd852..ae1f6fe 100644
--- 
a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/DefaultUndertowHttpBinding.java
+++ 
b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/DefaultUndertowHttpBinding.java
@@ -124,7 +124,7 @@ public class DefaultUndertowHttpBinding implements 
UndertowHttpBinding {
 } else {
 //extract body by myself if undertow parser didn't handle and the 
method is allowed to have one
 //body is extracted as byte[] then auto TypeConverter kicks in
-if (Methods.POST.equals(httpExchange.getRequestMethod()) || 
Methods.PUT.equals(httpExchange.getRequestMethod())) {
+if (Methods.POST.equals(httpExchange.getRequestMethod()) || 
Methods.PUT.equals(httpExchange.getRequestMethod()) || 
Methods.PATCH.equals(httpExchange.getRequestMethod())) {
 
result.setBody(readFromChannel(httpExchange.getRequestChannel()));
 } else {
 result.setBody(null);
diff --git 
a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowProducerPatchTest.java
 
b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowProducerPatchTest.java
new file mode 100644
index 000..bfbd59f
--- /dev/null
+++ 
b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowProducerPatchTest.java
@@ -0,0 +1,58 @@
+/**
+ * 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.component.undertow.rest;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.undertow.BaseUndertowTest;
+import org.junit.Test;
+
+public class RestUndertowProducerPatchTest extends BaseUndertowTest {
+
+@Test
+public void testUndertowProducerPatch() throws Exception {
+String body = "Donald Duck";
+String id = "123";
+
+MockEndpoint mock = getMockEndpoint("mock:input");
+mock.message(0).body().isEqualTo(body);
+mock.message(0).header("id").isEqualTo(id);
+
+fluentTemplate.withBody(body).withHeader("id", 
id).to("direct:start").send();
+
+assertMockEndpointsSatisfied();
+}
+
+@Override
+protected RouteBuilder createRouteBuilder() throws Exception {
+return new RouteBuilder() {
+@Override
+public void configure() throws Exception {
+// configure to use localhost with the given port
+
restConfiguration().component("undertow").host("localhost").port(getPort());
+
+from("direct:start")
+.to("rest:patch:users/{id}");
+
+// use the rest DSL to define the rest services
+rest("/users/")
+.patch("{id}")
+.to("mock:input");
+}
+};
+}
+}

-- 
To stop receiving notification emails like this one, please contact
davscl...@apache.org.


[camel] branch camel-2.20.x updated: CAMEL-12439: FailedToCreateRouteException should mask sensitive information in uris

2018-04-12 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/camel-2.20.x by this push:
 new f032f22  CAMEL-12439: FailedToCreateRouteException should mask 
sensitive information in uris
f032f22 is described below

commit f032f22b16b266b1fcde8889d529da1c7da6e1d2
Author: Claus Ibsen 
AuthorDate: Thu Apr 12 16:50:51 2018 +0200

CAMEL-12439: FailedToCreateRouteException should mask sensitive information 
in uris
---
 .../org/apache/camel/FailedToCreateRouteException.java   |  5 +
 .../camel/model/StartingRoutesErrorReportedTest.java | 16 
 2 files changed, 21 insertions(+)

diff --git 
a/camel-core/src/main/java/org/apache/camel/FailedToCreateRouteException.java 
b/camel-core/src/main/java/org/apache/camel/FailedToCreateRouteException.java
index 639384c..00599b3 100644
--- 
a/camel-core/src/main/java/org/apache/camel/FailedToCreateRouteException.java
+++ 
b/camel-core/src/main/java/org/apache/camel/FailedToCreateRouteException.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel;
 
+import org.apache.camel.util.URISupport;
+
 /**
  * Exception when failing to create a {@link org.apache.camel.Route}.
  *
@@ -48,6 +50,9 @@ public class FailedToCreateRouteException extends 
CamelException {
 }
 
 protected static String getRouteMessage(String route) {
+// ensure to sanitize uri's in the route so we do not show sensitive 
information such as passwords
+route = URISupport.sanitizeUri(route);
+
 // cut the route after 60 chars so it won't be too big in the message
 // users just need to be able to identify the route so they know where 
to look
 if (route.length() > 60) {
diff --git 
a/camel-core/src/test/java/org/apache/camel/model/StartingRoutesErrorReportedTest.java
 
b/camel-core/src/test/java/org/apache/camel/model/StartingRoutesErrorReportedTest.java
index e9beb08..11fcdd1 100644
--- 
a/camel-core/src/test/java/org/apache/camel/model/StartingRoutesErrorReportedTest.java
+++ 
b/camel-core/src/test/java/org/apache/camel/model/StartingRoutesErrorReportedTest.java
@@ -56,6 +56,22 @@ public class StartingRoutesErrorReportedTest extends 
ContextTestSupport {
 }
 }
 
+public void testMaskPassword() throws Exception {
+try {
+context.addRoutes(new RouteBuilder() {
+@Override
+public void configure() throws Exception {
+
from("stub:foo?password=secret&beer=yes").routeId("route2").to("direct:result?foo=bar");
+}
+});
+context.start();
+fail();
+} catch (FailedToCreateRouteException e) {
+assertTrue(e.getMessage().startsWith("Failed to create route 
route2 at: >>> To[direct:result?foo=bar] <<< in route:"
++ " 
Route(route2)[[From[stub:foo?password=xx&beer=yes]] -> [... because of"));
+}
+}
+
 public void testInvalidBean() throws Exception {
 try {
 context.addRoutes(new RouteBuilder() {

-- 
To stop receiving notification emails like this one, please contact
davscl...@apache.org.


[camel] branch camel-2.21.x updated: CAMEL-12439: FailedToCreateRouteException should mask sensitive information in uris

2018-04-12 Thread davsclaus
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/camel-2.21.x by this push:
 new 4d29417  CAMEL-12439: FailedToCreateRouteException should mask 
sensitive information in uris
4d29417 is described below

commit 4d294179203d96b2b97d909c30696fdc5e519794
Author: Claus Ibsen 
AuthorDate: Thu Apr 12 16:50:51 2018 +0200

CAMEL-12439: FailedToCreateRouteException should mask sensitive information 
in uris
---
 .../org/apache/camel/FailedToCreateRouteException.java   |  5 +
 .../camel/model/StartingRoutesErrorReportedTest.java | 16 
 2 files changed, 21 insertions(+)

diff --git 
a/camel-core/src/main/java/org/apache/camel/FailedToCreateRouteException.java 
b/camel-core/src/main/java/org/apache/camel/FailedToCreateRouteException.java
index 639384c..00599b3 100644
--- 
a/camel-core/src/main/java/org/apache/camel/FailedToCreateRouteException.java
+++ 
b/camel-core/src/main/java/org/apache/camel/FailedToCreateRouteException.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel;
 
+import org.apache.camel.util.URISupport;
+
 /**
  * Exception when failing to create a {@link org.apache.camel.Route}.
  *
@@ -48,6 +50,9 @@ public class FailedToCreateRouteException extends 
CamelException {
 }
 
 protected static String getRouteMessage(String route) {
+// ensure to sanitize uri's in the route so we do not show sensitive 
information such as passwords
+route = URISupport.sanitizeUri(route);
+
 // cut the route after 60 chars so it won't be too big in the message
 // users just need to be able to identify the route so they know where 
to look
 if (route.length() > 60) {
diff --git 
a/camel-core/src/test/java/org/apache/camel/model/StartingRoutesErrorReportedTest.java
 
b/camel-core/src/test/java/org/apache/camel/model/StartingRoutesErrorReportedTest.java
index e9beb08..11fcdd1 100644
--- 
a/camel-core/src/test/java/org/apache/camel/model/StartingRoutesErrorReportedTest.java
+++ 
b/camel-core/src/test/java/org/apache/camel/model/StartingRoutesErrorReportedTest.java
@@ -56,6 +56,22 @@ public class StartingRoutesErrorReportedTest extends 
ContextTestSupport {
 }
 }
 
+public void testMaskPassword() throws Exception {
+try {
+context.addRoutes(new RouteBuilder() {
+@Override
+public void configure() throws Exception {
+
from("stub:foo?password=secret&beer=yes").routeId("route2").to("direct:result?foo=bar");
+}
+});
+context.start();
+fail();
+} catch (FailedToCreateRouteException e) {
+assertTrue(e.getMessage().startsWith("Failed to create route 
route2 at: >>> To[direct:result?foo=bar] <<< in route:"
++ " 
Route(route2)[[From[stub:foo?password=xx&beer=yes]] -> [... because of"));
+}
+}
+
 public void testInvalidBean() throws Exception {
 try {
 context.addRoutes(new RouteBuilder() {

-- 
To stop receiving notification emails like this one, please contact
davscl...@apache.org.


[camel] branch master updated: CAMEL-11905: Added some route level tests for the camel-ganglia component

2018-04-12 Thread aldettinger
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new deec7bb  CAMEL-11905: Added some route level tests for the 
camel-ganglia component
deec7bb is described below

commit deec7bb4948f14f3b53f678760688813d6839235
Author: aldettinger 
AuthorDate: Thu Apr 12 22:43:43 2018 +0200

CAMEL-11905: Added some route level tests for the camel-ganglia component
---
 .../component/ganglia/CamelGangliaTestSupport.java | 34 ++
 .../camel/component/ganglia/GangliaCamelTest.java  | 72 ++
 2 files changed, 106 insertions(+)

diff --git 
a/components/camel-ganglia/src/test/java/org/apache/camel/component/ganglia/CamelGangliaTestSupport.java
 
b/components/camel-ganglia/src/test/java/org/apache/camel/component/ganglia/CamelGangliaTestSupport.java
new file mode 100644
index 000..6cd170e
--- /dev/null
+++ 
b/components/camel-ganglia/src/test/java/org/apache/camel/component/ganglia/CamelGangliaTestSupport.java
@@ -0,0 +1,34 @@
+/**
+ * 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.component.ganglia;
+
+import org.apache.camel.test.AvailablePortFinder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.BeforeClass;
+
+public class CamelGangliaTestSupport extends CamelTestSupport {
+private static int testPort;
+
+@BeforeClass
+public static void setup() {
+testPort = AvailablePortFinder.getNextAvailable();
+}
+
+protected int getTestPort() {
+return testPort;
+}
+}
diff --git 
a/components/camel-ganglia/src/test/java/org/apache/camel/component/ganglia/GangliaCamelTest.java
 
b/components/camel-ganglia/src/test/java/org/apache/camel/component/ganglia/GangliaCamelTest.java
new file mode 100644
index 000..139ade0
--- /dev/null
+++ 
b/components/camel-ganglia/src/test/java/org/apache/camel/component/ganglia/GangliaCamelTest.java
@@ -0,0 +1,72 @@
+/**
+ * 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.component.ganglia;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import info.ganglia.gmetric4j.gmetric.GMetricSlope;
+import info.ganglia.gmetric4j.gmetric.GMetricType;
+
+import org.apache.camel.ResolveEndpointFailedException;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+/**
+ * {@code GangliaCamelTest} is not shipped with an embedded gmond agent, as 
such
+ * datagrams sent by the camel-ganglia component during those tests are simply
+ * dropped at UDP level.
+ */
+public class GangliaCamelTest extends CamelGangliaTestSupport {
+
+@Rule
+public ExpectedException thrown = ExpectedException.none();
+
+private String getTestUri() {
+return "ganglia:localhost:" + getTestPort() + 
"?mode=UNICAST&metricName=temperature&type=Double";
+}
+
+@Test
+public void sendShouldNotThrow() {
+template.sendBody(getTestUri(), 28.0);
+}
+
+@Test
+public void sendUsingWireFormat30xShouldNotThrow() {
+template.sendBody(getTestUri() + "&wireFormat31x=false", 28.0);
+}
+
+@Test
+public void sendMessageHeadersOverridingEndpointOptionsShouldNotThrow() {
+Map headers = new HashMap<>();
+headers.put(GangliaConstants.GROUP_NAME, "sea-mesure");
+headers.put(GangliaCo