You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/08/06 19:12:32 UTC

[camel] branch master updated: CAMEL-13267: Enable automatic recovery on camel-rabbitmq in case connection fails for some reason.

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 a94f67d  CAMEL-13267: Enable automatic recovery on camel-rabbitmq in case connection fails for some reason.
a94f67d is described below

commit a94f67d4f1fb4c70ccd90dff3fb1f93c599b1fa6
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Aug 6 21:12:07 2019 +0200

    CAMEL-13267: Enable automatic recovery on camel-rabbitmq in case connection fails for some reason.
---
 .../src/main/docs/rabbitmq-component.adoc          |   2 +-
 .../camel/component/rabbitmq/RabbitMQEndpoint.java |   7 +-
 .../dsl/RabbitMQEndpointBuilderFactory.java        | 174 ++++++++++-----------
 3 files changed, 91 insertions(+), 92 deletions(-)

diff --git a/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc b/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc
index 28a3d63..52de565 100644
--- a/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc
+++ b/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc
@@ -136,6 +136,7 @@ with the following path and query parameters:
 | Name | Description | Default | Type
 | *addresses* (common) | If this option is set, camel-rabbitmq will try to create connection based on the setting of option addresses. The addresses value is a string which looks like server1:12345, server2:12345 |  | Address[]
 | *autoDelete* (common) | If it is true, the exchange will be deleted when it is no longer in use | true | boolean
+| *automaticRecoveryEnabled* (common) | Enables connection automatic recovery (uses connection implementation that performs automatic recovery when existing connection has failures) | true | Boolean
 | *connectionFactory* (common) | To use a custom RabbitMQ connection factory. When this option is set, all connection options (connectionTimeout, requestedChannelMax...) set on URI are not used |  | ConnectionFactory
 | *deadLetterExchange* (common) | The name of the dead letter exchange |  | String
 | *deadLetterExchangeType* (common) | The type of the dead letter exchange | direct | String
@@ -176,7 +177,6 @@ with the following path and query parameters:
 | *publisherAcknowledgements* (producer) | When true, the message will be published with publisher acknowledgements turned on | false | boolean
 | *publisherAcknowledgements Timeout* (producer) | The amount of time in milliseconds to wait for a basic.ack response from RabbitMQ server |  | long
 | *args* (advanced) | Specify arguments for configuring the different RabbitMQ concepts, a different prefix is required for each: Exchange: arg.exchange. Queue: arg.queue. Binding: arg.binding. For example to declare a queue with message ttl argument: \http://localhost:5672/exchange/queueargs=arg.queue.x-message-ttl=60000 |  | Map
-| *automaticRecoveryEnabled* (advanced) | Enables connection automatic recovery (uses connection implementation that performs automatic recovery when connection shutdown is not initiated by the application) |  | Boolean
 | *basicPropertyBinding* (advanced) | Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean
 | *clientProperties* (advanced) | Connection client properties (client info used in negotiating with the server) |  | Map
 | *connectionTimeout* (advanced) | Connection timeout | 60000 | int
diff --git a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java
index 39ed17d..56c01f9 100644
--- a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java
+++ b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQEndpoint.java
@@ -102,6 +102,8 @@ public class RabbitMQEndpoint extends DefaultEndpoint implements AsyncEndpoint {
     private boolean skipExchangeDeclare;
     @UriParam(label = "common")
     private Address[] addresses;
+    @UriParam(label = "common", defaultValue = "true")
+    private Boolean automaticRecoveryEnabled = Boolean.TRUE;
     @UriParam(label = "advanced", defaultValue = "" + ConnectionFactory.DEFAULT_CONNECTION_TIMEOUT)
     private int connectionTimeout = ConnectionFactory.DEFAULT_CONNECTION_TIMEOUT;
     @UriParam(label = "advanced", defaultValue = "" + ConnectionFactory.DEFAULT_CHANNEL_MAX)
@@ -116,8 +118,6 @@ public class RabbitMQEndpoint extends DefaultEndpoint implements AsyncEndpoint {
     private TrustManager trustManager;
     @UriParam(label = "advanced")
     private Map<String, Object> clientProperties;
-    @UriParam(label = "advanced")
-    private Boolean automaticRecoveryEnabled;
     @UriParam(label = "advanced", defaultValue = "5000")
     private Integer networkRecoveryInterval = 5000;
     @UriParam(label = "advanced")
@@ -567,8 +567,7 @@ public class RabbitMQEndpoint extends DefaultEndpoint implements AsyncEndpoint {
 
     /**
      * Enables connection automatic recovery (uses connection implementation
-     * that performs automatic recovery when connection shutdown is not
-     * initiated by the application)
+     * that performs automatic recovery when existing connection has failures)
      */
     public void setAutomaticRecoveryEnabled(Boolean automaticRecoveryEnabled) {
         this.automaticRecoveryEnabled = automaticRecoveryEnabled;
diff --git a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/RabbitMQEndpointBuilderFactory.java b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/RabbitMQEndpointBuilderFactory.java
index fceec23..2007b1f 100644
--- a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/RabbitMQEndpointBuilderFactory.java
+++ b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/RabbitMQEndpointBuilderFactory.java
@@ -95,6 +95,35 @@ public interface RabbitMQEndpointBuilderFactory {
             return this;
         }
         /**
+         * Enables connection automatic recovery (uses connection implementation
+         * that performs automatic recovery when existing connection has
+         * failures).
+         * 
+         * The option is a: <code>java.lang.Boolean</code> type.
+         * 
+         * Group: common
+         */
+        default RabbitMQEndpointConsumerBuilder automaticRecoveryEnabled(
+                Boolean automaticRecoveryEnabled) {
+            setProperty("automaticRecoveryEnabled", automaticRecoveryEnabled);
+            return this;
+        }
+        /**
+         * Enables connection automatic recovery (uses connection implementation
+         * that performs automatic recovery when existing connection has
+         * failures).
+         * 
+         * The option will be converted to a <code>java.lang.Boolean</code>
+         * type.
+         * 
+         * Group: common
+         */
+        default RabbitMQEndpointConsumerBuilder automaticRecoveryEnabled(
+                String automaticRecoveryEnabled) {
+            setProperty("automaticRecoveryEnabled", automaticRecoveryEnabled);
+            return this;
+        }
+        /**
          * To use a custom RabbitMQ connection factory. When this option is set,
          * all connection options (connectionTimeout, requestedChannelMax...)
          * set on URI are not used.
@@ -836,35 +865,6 @@ public interface RabbitMQEndpointBuilderFactory {
             return this;
         }
         /**
-         * Enables connection automatic recovery (uses connection implementation
-         * that performs automatic recovery when connection shutdown is not
-         * initiated by the application).
-         * 
-         * The option is a: <code>java.lang.Boolean</code> type.
-         * 
-         * Group: advanced
-         */
-        default AdvancedRabbitMQEndpointConsumerBuilder automaticRecoveryEnabled(
-                Boolean automaticRecoveryEnabled) {
-            setProperty("automaticRecoveryEnabled", automaticRecoveryEnabled);
-            return this;
-        }
-        /**
-         * Enables connection automatic recovery (uses connection implementation
-         * that performs automatic recovery when connection shutdown is not
-         * initiated by the application).
-         * 
-         * The option will be converted to a <code>java.lang.Boolean</code>
-         * type.
-         * 
-         * Group: advanced
-         */
-        default AdvancedRabbitMQEndpointConsumerBuilder automaticRecoveryEnabled(
-                String automaticRecoveryEnabled) {
-            setProperty("automaticRecoveryEnabled", automaticRecoveryEnabled);
-            return this;
-        }
-        /**
          * Whether the endpoint should use basic property binding (Camel 2.x) or
          * the newer property binding with additional capabilities.
          * 
@@ -1234,6 +1234,35 @@ public interface RabbitMQEndpointBuilderFactory {
             return this;
         }
         /**
+         * Enables connection automatic recovery (uses connection implementation
+         * that performs automatic recovery when existing connection has
+         * failures).
+         * 
+         * The option is a: <code>java.lang.Boolean</code> type.
+         * 
+         * Group: common
+         */
+        default RabbitMQEndpointProducerBuilder automaticRecoveryEnabled(
+                Boolean automaticRecoveryEnabled) {
+            setProperty("automaticRecoveryEnabled", automaticRecoveryEnabled);
+            return this;
+        }
+        /**
+         * Enables connection automatic recovery (uses connection implementation
+         * that performs automatic recovery when existing connection has
+         * failures).
+         * 
+         * The option will be converted to a <code>java.lang.Boolean</code>
+         * type.
+         * 
+         * Group: common
+         */
+        default RabbitMQEndpointProducerBuilder automaticRecoveryEnabled(
+                String automaticRecoveryEnabled) {
+            setProperty("automaticRecoveryEnabled", automaticRecoveryEnabled);
+            return this;
+        }
+        /**
          * To use a custom RabbitMQ connection factory. When this option is set,
          * all connection options (connectionTimeout, requestedChannelMax...)
          * set on URI are not used.
@@ -1955,35 +1984,6 @@ public interface RabbitMQEndpointBuilderFactory {
             return this;
         }
         /**
-         * Enables connection automatic recovery (uses connection implementation
-         * that performs automatic recovery when connection shutdown is not
-         * initiated by the application).
-         * 
-         * The option is a: <code>java.lang.Boolean</code> type.
-         * 
-         * Group: advanced
-         */
-        default AdvancedRabbitMQEndpointProducerBuilder automaticRecoveryEnabled(
-                Boolean automaticRecoveryEnabled) {
-            setProperty("automaticRecoveryEnabled", automaticRecoveryEnabled);
-            return this;
-        }
-        /**
-         * Enables connection automatic recovery (uses connection implementation
-         * that performs automatic recovery when connection shutdown is not
-         * initiated by the application).
-         * 
-         * The option will be converted to a <code>java.lang.Boolean</code>
-         * type.
-         * 
-         * Group: advanced
-         */
-        default AdvancedRabbitMQEndpointProducerBuilder automaticRecoveryEnabled(
-                String automaticRecoveryEnabled) {
-            setProperty("automaticRecoveryEnabled", automaticRecoveryEnabled);
-            return this;
-        }
-        /**
          * Whether the endpoint should use basic property binding (Camel 2.x) or
          * the newer property binding with additional capabilities.
          * 
@@ -2353,6 +2353,35 @@ public interface RabbitMQEndpointBuilderFactory {
             return this;
         }
         /**
+         * Enables connection automatic recovery (uses connection implementation
+         * that performs automatic recovery when existing connection has
+         * failures).
+         * 
+         * The option is a: <code>java.lang.Boolean</code> type.
+         * 
+         * Group: common
+         */
+        default RabbitMQEndpointBuilder automaticRecoveryEnabled(
+                Boolean automaticRecoveryEnabled) {
+            setProperty("automaticRecoveryEnabled", automaticRecoveryEnabled);
+            return this;
+        }
+        /**
+         * Enables connection automatic recovery (uses connection implementation
+         * that performs automatic recovery when existing connection has
+         * failures).
+         * 
+         * The option will be converted to a <code>java.lang.Boolean</code>
+         * type.
+         * 
+         * Group: common
+         */
+        default RabbitMQEndpointBuilder automaticRecoveryEnabled(
+                String automaticRecoveryEnabled) {
+            setProperty("automaticRecoveryEnabled", automaticRecoveryEnabled);
+            return this;
+        }
+        /**
          * To use a custom RabbitMQ connection factory. When this option is set,
          * all connection options (connectionTimeout, requestedChannelMax...)
          * set on URI are not used.
@@ -2785,35 +2814,6 @@ public interface RabbitMQEndpointBuilderFactory {
             return this;
         }
         /**
-         * Enables connection automatic recovery (uses connection implementation
-         * that performs automatic recovery when connection shutdown is not
-         * initiated by the application).
-         * 
-         * The option is a: <code>java.lang.Boolean</code> type.
-         * 
-         * Group: advanced
-         */
-        default AdvancedRabbitMQEndpointBuilder automaticRecoveryEnabled(
-                Boolean automaticRecoveryEnabled) {
-            setProperty("automaticRecoveryEnabled", automaticRecoveryEnabled);
-            return this;
-        }
-        /**
-         * Enables connection automatic recovery (uses connection implementation
-         * that performs automatic recovery when connection shutdown is not
-         * initiated by the application).
-         * 
-         * The option will be converted to a <code>java.lang.Boolean</code>
-         * type.
-         * 
-         * Group: advanced
-         */
-        default AdvancedRabbitMQEndpointBuilder automaticRecoveryEnabled(
-                String automaticRecoveryEnabled) {
-            setProperty("automaticRecoveryEnabled", automaticRecoveryEnabled);
-            return this;
-        }
-        /**
          * Whether the endpoint should use basic property binding (Camel 2.x) or
          * the newer property binding with additional capabilities.
          *