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 <claus.ib...@gmail.com> 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. | 10000 | 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 30000 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. | 300000 | 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 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 {@link NettyCamelStateCorrelationManager} + * as correlation manager and configure it via the <tt>correlationManager</tt> option. + * <p/> + * See also the <tt>correlationManager</tt> option for more details. */ public void setProducerPoolEnabled(boolean producerPoolEnabled) { this.producerPoolEnabled = producerPoolEnabled; @@ -667,6 +674,8 @@ public class NettyConfiguration extends NettyServerBootstrapConfiguration implem * 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 request and reply messages so you can store the right reply on the inflight Camel Exchange before * its continued routed. + * <p/> + * See also the <tt>producerPoolEnabled</tt> option for more details. */ public void setCorrelationManager(NettyCamelStateCorrelationManager correlationManager) { this.correlationManager = correlationManager; diff --git a/platforms/spring-boot/components-starter/camel-netty4-starter/src/main/java/org/apache/camel/component/netty4/springboot/NettyComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-netty4-starter/src/main/java/org/apache/camel/component/netty4/springboot/NettyComponentConfiguration.java index 0125ee4..99d0c33 100644 --- a/platforms/spring-boot/components-starter/camel-netty4-starter/src/main/java/org/apache/camel/component/netty4/springboot/NettyComponentConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-netty4-starter/src/main/java/org/apache/camel/component/netty4/springboot/NettyComponentConfiguration.java @@ -273,9 +273,18 @@ public class NettyComponentConfiguration */ private Long producerPoolMinEvictableIdle = 300000L; /** - * 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. + * 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 processing the message in + * Camel. To do this you need to implement + * {@link NettyCamelStateCorrelationManager} as correlation manager and + * configure it via the <tt>correlationManager</tt> option. + * <p/> + * See also the <tt>correlationManager</tt> option for more details. */ private Boolean producerPoolEnabled = true; /** @@ -324,6 +333,8 @@ public class NettyComponentConfiguration * When doing 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. + * <p/> + * See also the <tt>producerPoolEnabled</tt> option for more details. */ private NettyCamelStateCorrelationManager correlationManager; /** -- To stop receiving notification emails like this one, please contact davscl...@apache.org.