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 2020/03/12 18:54:54 UTC

[camel] branch master updated: CAMEL-14455: rabbitmq exception handler for connection factory (#3629)

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 a55f563  CAMEL-14455: rabbitmq exception handler for connection factory (#3629)
a55f563 is described below

commit a55f563de14cb5606c5b42381e3e9a7d8889d751
Author: Kirill Yankov <my...@gmail.com>
AuthorDate: Fri Mar 13 03:54:42 2020 +0900

    CAMEL-14455: rabbitmq exception handler for connection factory (#3629)
---
 .../rabbitmq/RabbitMQComponentConfigurer.java      |  2 +
 .../rabbitmq/RabbitMQEndpointConfigurer.java       |  2 +
 .../apache/camel/component/rabbitmq/rabbitmq.json  |  2 +
 .../src/main/docs/rabbitmq-component.adoc          |  6 +-
 .../component/rabbitmq/RabbitMQComponent.java      | 15 +++++
 .../rabbitmq/RabbitMQConnectionFactorySupport.java |  3 +
 .../camel/component/rabbitmq/RabbitMQEndpoint.java | 15 +++++
 .../RabbitMQSpringExceptionHandlerTest.java        | 63 +++++++++++++++++
 .../testbeans/CustomRabbitExceptionHandler.java    | 67 +++++++++++++++++++
 ...bbitMQSpringExceptionHandlerIntTest-context.xml | 35 ++++++++++
 .../dsl/RabbitmqComponentBuilderFactory.java       | 14 ++++
 .../dsl/RabbitMQEndpointBuilderFactory.java        | 78 ++++++++++++++++++++++
 12 files changed, 300 insertions(+), 2 deletions(-)

diff --git a/components/camel-rabbitmq/src/generated/java/org/apache/camel/component/rabbitmq/RabbitMQComponentConfigurer.java b/components/camel-rabbitmq/src/generated/java/org/apache/camel/component/rabbitmq/RabbitMQComponentConfigurer.java
index bddcb59..41c50e6 100644
--- a/components/camel-rabbitmq/src/generated/java/org/apache/camel/component/rabbitmq/RabbitMQComponentConfigurer.java
+++ b/components/camel-rabbitmq/src/generated/java/org/apache/camel/component/rabbitmq/RabbitMQComponentConfigurer.java
@@ -39,6 +39,8 @@ public class RabbitMQComponentConfigurer extends PropertyConfigurerSupport imple
         case "clientProperties": target.setClientProperties(property(camelContext, java.util.Map.class, value)); return true;
         case "connectionfactory":
         case "connectionFactory": target.setConnectionFactory(property(camelContext, com.rabbitmq.client.ConnectionFactory.class, value)); return true;
+        case "connectionfactoryexceptionhandler":
+        case "connectionFactoryExceptionHandler": target.setConnectionFactoryExceptionHandler(property(camelContext, com.rabbitmq.client.ExceptionHandler.class, value)); return true;
         case "connectiontimeout":
         case "connectionTimeout": target.setConnectionTimeout(property(camelContext, int.class, value)); return true;
         case "deadletterexchange":
diff --git a/components/camel-rabbitmq/src/generated/java/org/apache/camel/component/rabbitmq/RabbitMQEndpointConfigurer.java b/components/camel-rabbitmq/src/generated/java/org/apache/camel/component/rabbitmq/RabbitMQEndpointConfigurer.java
index e9a909c..ae7b9f4 100644
--- a/components/camel-rabbitmq/src/generated/java/org/apache/camel/component/rabbitmq/RabbitMQEndpointConfigurer.java
+++ b/components/camel-rabbitmq/src/generated/java/org/apache/camel/component/rabbitmq/RabbitMQEndpointConfigurer.java
@@ -43,6 +43,8 @@ public class RabbitMQEndpointConfigurer extends PropertyConfigurerSupport implem
         case "concurrentConsumers": target.setConcurrentConsumers(property(camelContext, int.class, value)); return true;
         case "connectionfactory":
         case "connectionFactory": target.setConnectionFactory(property(camelContext, com.rabbitmq.client.ConnectionFactory.class, value)); return true;
+        case "connectionfactoryexceptionhandler":
+        case "connectionFactoryExceptionHandler": target.setConnectionFactoryExceptionHandler(property(camelContext, com.rabbitmq.client.ExceptionHandler.class, value)); return true;
         case "connectiontimeout":
         case "connectionTimeout": target.setConnectionTimeout(property(camelContext, int.class, value)); return true;
         case "consumertag":
diff --git a/components/camel-rabbitmq/src/generated/resources/org/apache/camel/component/rabbitmq/rabbitmq.json b/components/camel-rabbitmq/src/generated/resources/org/apache/camel/component/rabbitmq/rabbitmq.json
index 3acc988..2a6de1d 100644
--- a/components/camel-rabbitmq/src/generated/resources/org/apache/camel/component/rabbitmq/rabbitmq.json
+++ b/components/camel-rabbitmq/src/generated/resources/org/apache/camel/component/rabbitmq/rabbitmq.json
@@ -58,6 +58,7 @@
     "automaticRecoveryEnabled": { "kind": "property", "displayName": "Automatic Recovery Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "secret": false, "description": "Enables connection automatic recovery (uses connection implementation that performs automatic recovery when connection shutdown is not initiated by the application)" },
     "basicPropertyBinding": { "kind": "property", "displayName": "Basic Property Binding", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities" },
     "clientProperties": { "kind": "property", "displayName": "Client Properties", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "deprecated": false, "secret": false, "description": "Connection client properties (client info used in negotiating with the server)" },
+    "connectionFactoryExceptionHandler": { "kind": "property", "displayName": "Connection Factory Exception Handler", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "com.rabbitmq.client.ExceptionHandler", "deprecated": false, "secret": false, "description": "Custom rabbitmq ExceptionHandler for ConnectionFactory" },
     "connectionTimeout": { "kind": "property", "displayName": "Connection Timeout", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "secret": false, "defaultValue": "60000", "description": "Connection timeout" },
     "networkRecoveryInterval": { "kind": "property", "displayName": "Network Recovery Interval", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "secret": false, "defaultValue": "5000", "description": "Network recovery interval in milliseconds (interval used when recovering from network failure)" },
     "requestedChannelMax": { "kind": "property", "displayName": "Requested Channel Max", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "secret": false, "defaultValue": "2047", "description": "Connection requested channel max (max number of channels offered)" },
@@ -121,6 +122,7 @@
     "args": { "kind": "parameter", "displayName": "Args", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "arg.", "multiValue": true, "deprecated": false, "secret": false, "description": "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 q [...]
     "basicPropertyBinding": { "kind": "parameter", "displayName": "Basic Property Binding", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities" },
     "clientProperties": { "kind": "parameter", "displayName": "Client Properties", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "deprecated": false, "secret": false, "description": "Connection client properties (client info used in negotiating with the server)" },
+    "connectionFactoryExceptionHandler": { "kind": "parameter", "displayName": "Connection Factory Exception Handler", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "com.rabbitmq.client.ExceptionHandler", "deprecated": false, "secret": false, "description": "Custom rabbitmq ExceptionHandler for ConnectionFactory" },
     "connectionTimeout": { "kind": "parameter", "displayName": "Connection Timeout", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "secret": false, "defaultValue": "60000", "description": "Connection timeout" },
     "networkRecoveryInterval": { "kind": "parameter", "displayName": "Network Recovery Interval", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "secret": false, "defaultValue": "5000", "description": "Network recovery interval in milliseconds (interval used when recovering from network failure)" },
     "requestedChannelMax": { "kind": "parameter", "displayName": "Requested Channel Max", "group": "advanced", "label": "advanced", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "secret": false, "defaultValue": "2047", "description": "Connection requested channel max (max number of channels offered)" },
diff --git a/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc b/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc
index 1cde01f..0d3eb7a 100644
--- a/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc
+++ b/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc
@@ -51,7 +51,7 @@ exchange name determines which exchange the queue will bind to.
 == Options
 
 // component options: START
-The RabbitMQ component supports 52 options, which are listed below.
+The RabbitMQ component supports 53 options, which are listed below.
 
 
 
@@ -97,6 +97,7 @@ The RabbitMQ component supports 52 options, which are listed below.
 | *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 component 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
+| *connectionFactoryException Handler* (advanced) | Custom rabbitmq ExceptionHandler for ConnectionFactory |  | ExceptionHandler
 | *connectionTimeout* (advanced) | Connection timeout | 60000 | int
 | *networkRecoveryInterval* (advanced) | Network recovery interval in milliseconds (interval used when recovering from network failure) | 5000 | Integer
 | *requestedChannelMax* (advanced) | Connection requested channel max (max number of channels offered) | 2047 | int
@@ -133,7 +134,7 @@ with the following path and query parameters:
 |===
 
 
-=== Query Parameters (61 parameters):
+=== Query Parameters (62 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
@@ -186,6 +187,7 @@ with the following path and query parameters:
 | *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
 | *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
+| *connectionFactoryException Handler* (advanced) | Custom rabbitmq ExceptionHandler for ConnectionFactory |  | ExceptionHandler
 | *connectionTimeout* (advanced) | Connection timeout | 60000 | int
 | *networkRecoveryInterval* (advanced) | Network recovery interval in milliseconds (interval used when recovering from network failure) | 5000 | Integer
 | *requestedChannelMax* (advanced) | Connection requested channel max (max number of channels offered) | 2047 | int
diff --git a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQComponent.java b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQComponent.java
index 8ac459e..b300df7 100644
--- a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQComponent.java
+++ b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQComponent.java
@@ -23,6 +23,7 @@ import java.util.Map;
 import javax.net.ssl.TrustManager;
 
 import com.rabbitmq.client.ConnectionFactory;
+import com.rabbitmq.client.ExceptionHandler;
 import org.apache.camel.CamelContext;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.annotations.Component;
@@ -139,6 +140,8 @@ public class RabbitMQComponent extends DefaultComponent {
     private Map<String, Object> args;
     @Metadata(label = "advanced")
     private Map<String, Object> clientProperties;
+    @Metadata(label = "advanced")
+    private ExceptionHandler connectionFactoryExceptionHandler;
 
     public RabbitMQComponent() {
     }
@@ -244,6 +247,7 @@ public class RabbitMQComponent extends DefaultComponent {
         endpoint.setDeadLetterQueue(getDeadLetterQueue());
         endpoint.setDeadLetterRoutingKey(getDeadLetterRoutingKey());
         endpoint.setAllowNullHeaders(isAllowNullHeaders());
+        endpoint.setConnectionFactoryExceptionHandler(getConnectionFactoryExceptionHandler());
         setProperties(endpoint, params);
 
         if (LOG.isDebugEnabled()) {
@@ -866,4 +870,15 @@ public class RabbitMQComponent extends DefaultComponent {
     public void setAllowNullHeaders(boolean allowNullHeaders) {
         this.allowNullHeaders = allowNullHeaders;
     }
+
+    public ExceptionHandler getConnectionFactoryExceptionHandler() {
+        return connectionFactoryExceptionHandler;
+    }
+
+    /**
+     * Custom rabbitmq ExceptionHandler for ConnectionFactory
+     */
+    public void setConnectionFactoryExceptionHandler(ExceptionHandler connectionFactoryExceptionHandler) {
+        this.connectionFactoryExceptionHandler = connectionFactoryExceptionHandler;
+    }
 }
diff --git a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQConnectionFactorySupport.java b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQConnectionFactorySupport.java
index 07b83b8..490c33f 100644
--- a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQConnectionFactorySupport.java
+++ b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQConnectionFactorySupport.java
@@ -59,6 +59,9 @@ public class RabbitMQConnectionFactorySupport {
         if (endpoint.getTopologyRecoveryEnabled() != null) {
             factory.setTopologyRecoveryEnabled(endpoint.getTopologyRecoveryEnabled());
         }
+        if (endpoint.getConnectionFactoryExceptionHandler() != null) {
+            factory.setExceptionHandler(endpoint.getConnectionFactoryExceptionHandler());
+        }
         return factory;
     }
 }
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 85202b1..6c77b18 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
@@ -31,6 +31,7 @@ import com.rabbitmq.client.Channel;
 import com.rabbitmq.client.Connection;
 import com.rabbitmq.client.ConnectionFactory;
 import com.rabbitmq.client.Envelope;
+import com.rabbitmq.client.ExceptionHandler;
 import org.apache.camel.AsyncEndpoint;
 import org.apache.camel.Consumer;
 import org.apache.camel.Exchange;
@@ -170,6 +171,9 @@ public class RabbitMQEndpoint extends DefaultEndpoint implements AsyncEndpoint {
     private boolean allowCustomHeaders = true;
     @UriParam(label = "consumer")
     private String consumerTag = "";
+    @UriParam(label = "advanced")
+    private ExceptionHandler connectionFactoryExceptionHandler;
+
     // camel-jms supports this setting but it is not currently configurable in
     // camel-rabbitmq
     private boolean useMessageIDAsCorrelationID = true;
@@ -976,4 +980,15 @@ public class RabbitMQEndpoint extends DefaultEndpoint implements AsyncEndpoint {
         this.allowCustomHeaders = allowCustomHeaders;
     }
 
+
+    public ExceptionHandler getConnectionFactoryExceptionHandler() {
+        return connectionFactoryExceptionHandler;
+    }
+
+    /**
+     * Custom rabbitmq ExceptionHandler for ConnectionFactory
+     */
+    public void setConnectionFactoryExceptionHandler(ExceptionHandler connectionFactoryExceptionHandler) {
+        this.connectionFactoryExceptionHandler = connectionFactoryExceptionHandler;
+    }
 }
diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQSpringExceptionHandlerTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQSpringExceptionHandlerTest.java
new file mode 100644
index 0000000..7bea206
--- /dev/null
+++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQSpringExceptionHandlerTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.rabbitmq;
+
+
+import org.apache.camel.Component;
+import org.apache.camel.Endpoint;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.component.rabbitmq.testbeans.CustomRabbitExceptionHandler;
+import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class RabbitMQSpringExceptionHandlerTest extends CamelSpringTestSupport {
+
+    @EndpointInject("rabbitmq:localhost:5672/foo?username=cameltest&password=cameltest&connectionFactoryExceptionHandler=#customExceptionHandler")
+    private Endpoint foo;
+
+
+    protected String getConfigLocation() {
+        return "classpath:/RabbitMQSpringExceptionHandlerIntTest-context.xml";
+    }
+
+    @Test
+    public void checkExceptionHandlerWasInjected() {
+        RabbitMQEndpoint endp = (RabbitMQEndpoint) foo;
+        assertEquals(endp.getConnectionFactoryExceptionHandler().getClass(), CustomRabbitExceptionHandler.class);
+    }
+
+    @Test
+    public void checkComponentSetsExceptionHandler() throws Exception {
+        Component comp = context().getComponent("rabbitmq");
+        RabbitMQEndpoint endp = (RabbitMQEndpoint) comp.createEndpoint("rabbitmq:localhost:5672/foo?username=cameltest&password=cameltest&connectionFactoryExceptionHandler=#customExceptionHandler");
+        assertEquals(endp.getConnectionFactoryExceptionHandler().getClass(), CustomRabbitExceptionHandler.class);
+    }
+
+    @Test
+    public void checkComponentIgnoresExceptionHandler() throws Exception {
+        Component comp = context().getComponent("rabbitmq");
+        RabbitMQEndpoint endp = (RabbitMQEndpoint) comp.createEndpoint("rabbitmq:localhost:5672/foo?username=cameltest&password=cameltest&connectionFactoryExceptionHandler=#customExceptionHandler&connectionFactory=#customConnectionFactory");
+        assertNotEquals(endp.getConnectionFactory().getExceptionHandler().getClass(), CustomRabbitExceptionHandler.class);
+    }
+
+    @Override
+    protected AbstractApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext(getConfigLocation());
+    }
+}
diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/testbeans/CustomRabbitExceptionHandler.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/testbeans/CustomRabbitExceptionHandler.java
new file mode 100644
index 0000000..8abeab4
--- /dev/null
+++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/testbeans/CustomRabbitExceptionHandler.java
@@ -0,0 +1,67 @@
+/*
+ * 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.rabbitmq.testbeans;
+
+import com.rabbitmq.client.Channel;
+import com.rabbitmq.client.Connection;
+import com.rabbitmq.client.Consumer;
+import com.rabbitmq.client.ExceptionHandler;
+import com.rabbitmq.client.TopologyRecoveryException;
+
+
+public class CustomRabbitExceptionHandler implements ExceptionHandler {
+
+    @Override
+    public void handleUnexpectedConnectionDriverException(Connection connection, Throwable throwable) {
+
+    }
+
+    @Override
+    public void handleReturnListenerException(Channel channel, Throwable throwable) {
+
+    }
+
+    @Override
+    public void handleConfirmListenerException(Channel channel, Throwable throwable) {
+
+    }
+
+    @Override
+    public void handleBlockedListenerException(Connection connection, Throwable throwable) {
+
+    }
+
+    @Override
+    public void handleConsumerException(Channel channel, Throwable throwable, Consumer consumer, String s, String s1) {
+
+    }
+
+    @Override
+    public void handleConnectionRecoveryException(Connection connection, Throwable throwable) {
+
+    }
+
+    @Override
+    public void handleChannelRecoveryException(Channel channel, Throwable throwable) {
+
+    }
+
+    @Override
+    public void handleTopologyRecoveryException(Connection connection, Channel channel, TopologyRecoveryException e) {
+
+    }
+}
diff --git a/components/camel-rabbitmq/src/test/resources/RabbitMQSpringExceptionHandlerIntTest-context.xml b/components/camel-rabbitmq/src/test/resources/RabbitMQSpringExceptionHandlerIntTest-context.xml
new file mode 100644
index 0000000..c0f3c2f
--- /dev/null
+++ b/components/camel-rabbitmq/src/test/resources/RabbitMQSpringExceptionHandlerIntTest-context.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+                           http://www.springframework.org/schema/beans/spring-beans.xsd
+                           http://camel.apache.org/schema/spring
+                           http://camel.apache.org/schema/spring/camel-spring.xsd">
+  <!-- START SNIPPET: custom connection factory -->
+  <bean class="org.apache.camel.component.rabbitmq.testbeans.CustomRabbitExceptionHandler" id="customExceptionHandler"/>
+  <bean class="com.rabbitmq.client.ConnectionFactory" id="customConnectionFactory">
+    <property name="host" value="localhost"/>
+    <property name="port" value="5672"/>
+    <property name="username" value="cameltest"/>
+    <property name="password" value="cameltest"/>
+  </bean>
+  <!-- END SNIPPET: example -->
+</beans>
diff --git a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/RabbitmqComponentBuilderFactory.java b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/RabbitmqComponentBuilderFactory.java
index 0cebd9d..5af40a0 100644
--- a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/RabbitmqComponentBuilderFactory.java
+++ b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/RabbitmqComponentBuilderFactory.java
@@ -597,6 +597,19 @@ public interface RabbitmqComponentBuilderFactory {
             return this;
         }
         /**
+         * Custom rabbitmq ExceptionHandler for ConnectionFactory.
+         * 
+         * The option is a: <code>com.rabbitmq.client.ExceptionHandler</code>
+         * type.
+         * 
+         * Group: advanced
+         */
+        default RabbitmqComponentBuilder connectionFactoryExceptionHandler(
+                com.rabbitmq.client.ExceptionHandler connectionFactoryExceptionHandler) {
+            doSetProperty("connectionFactoryExceptionHandler", connectionFactoryExceptionHandler);
+            return this;
+        }
+        /**
          * Connection timeout.
          * 
          * The option is a: <code>int</code> type.
@@ -818,6 +831,7 @@ public interface RabbitmqComponentBuilderFactory {
             case "automaticRecoveryEnabled": ((RabbitMQComponent) component).setAutomaticRecoveryEnabled((java.lang.Boolean) value); return true;
             case "basicPropertyBinding": ((RabbitMQComponent) component).setBasicPropertyBinding((boolean) value); return true;
             case "clientProperties": ((RabbitMQComponent) component).setClientProperties((java.util.Map) value); return true;
+            case "connectionFactoryExceptionHandler": ((RabbitMQComponent) component).setConnectionFactoryExceptionHandler((com.rabbitmq.client.ExceptionHandler) value); return true;
             case "connectionTimeout": ((RabbitMQComponent) component).setConnectionTimeout((int) value); return true;
             case "networkRecoveryInterval": ((RabbitMQComponent) component).setNetworkRecoveryInterval((java.lang.Integer) value); return true;
             case "requestedChannelMax": ((RabbitMQComponent) component).setRequestedChannelMax((int) value); return true;
diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/RabbitMQEndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/RabbitMQEndpointBuilderFactory.java
index 4226e31..38b591d 100644
--- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/RabbitMQEndpointBuilderFactory.java
+++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/RabbitMQEndpointBuilderFactory.java
@@ -957,6 +957,32 @@ public interface RabbitMQEndpointBuilderFactory {
             return this;
         }
         /**
+         * Custom rabbitmq ExceptionHandler for ConnectionFactory.
+         * 
+         * The option is a: <code>com.rabbitmq.client.ExceptionHandler</code>
+         * type.
+         * 
+         * Group: advanced
+         */
+        default AdvancedRabbitMQEndpointConsumerBuilder connectionFactoryExceptionHandler(
+                Object connectionFactoryExceptionHandler) {
+            doSetProperty("connectionFactoryExceptionHandler", connectionFactoryExceptionHandler);
+            return this;
+        }
+        /**
+         * Custom rabbitmq ExceptionHandler for ConnectionFactory.
+         * 
+         * The option will be converted to a
+         * <code>com.rabbitmq.client.ExceptionHandler</code> type.
+         * 
+         * Group: advanced
+         */
+        default AdvancedRabbitMQEndpointConsumerBuilder connectionFactoryExceptionHandler(
+                String connectionFactoryExceptionHandler) {
+            doSetProperty("connectionFactoryExceptionHandler", connectionFactoryExceptionHandler);
+            return this;
+        }
+        /**
          * Connection timeout.
          * 
          * The option is a: <code>int</code> type.
@@ -2149,6 +2175,32 @@ public interface RabbitMQEndpointBuilderFactory {
             return this;
         }
         /**
+         * Custom rabbitmq ExceptionHandler for ConnectionFactory.
+         * 
+         * The option is a: <code>com.rabbitmq.client.ExceptionHandler</code>
+         * type.
+         * 
+         * Group: advanced
+         */
+        default AdvancedRabbitMQEndpointProducerBuilder connectionFactoryExceptionHandler(
+                Object connectionFactoryExceptionHandler) {
+            doSetProperty("connectionFactoryExceptionHandler", connectionFactoryExceptionHandler);
+            return this;
+        }
+        /**
+         * Custom rabbitmq ExceptionHandler for ConnectionFactory.
+         * 
+         * The option will be converted to a
+         * <code>com.rabbitmq.client.ExceptionHandler</code> type.
+         * 
+         * Group: advanced
+         */
+        default AdvancedRabbitMQEndpointProducerBuilder connectionFactoryExceptionHandler(
+                String connectionFactoryExceptionHandler) {
+            doSetProperty("connectionFactoryExceptionHandler", connectionFactoryExceptionHandler);
+            return this;
+        }
+        /**
          * Connection timeout.
          * 
          * The option is a: <code>int</code> type.
@@ -3010,6 +3062,32 @@ public interface RabbitMQEndpointBuilderFactory {
             return this;
         }
         /**
+         * Custom rabbitmq ExceptionHandler for ConnectionFactory.
+         * 
+         * The option is a: <code>com.rabbitmq.client.ExceptionHandler</code>
+         * type.
+         * 
+         * Group: advanced
+         */
+        default AdvancedRabbitMQEndpointBuilder connectionFactoryExceptionHandler(
+                Object connectionFactoryExceptionHandler) {
+            doSetProperty("connectionFactoryExceptionHandler", connectionFactoryExceptionHandler);
+            return this;
+        }
+        /**
+         * Custom rabbitmq ExceptionHandler for ConnectionFactory.
+         * 
+         * The option will be converted to a
+         * <code>com.rabbitmq.client.ExceptionHandler</code> type.
+         * 
+         * Group: advanced
+         */
+        default AdvancedRabbitMQEndpointBuilder connectionFactoryExceptionHandler(
+                String connectionFactoryExceptionHandler) {
+            doSetProperty("connectionFactoryExceptionHandler", connectionFactoryExceptionHandler);
+            return this;
+        }
+        /**
          * Connection timeout.
          * 
          * The option is a: <code>int</code> type.