This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new bc54c4929bd CAMEL-20803: camel-spring-rabbitmq - Configuring
maximumRetryAttempts should accept 0
bc54c4929bd is described below
commit bc54c4929bdb58d5d1c56c6563a620d245d1e3a4
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat May 25 09:30:51 2024 +0200
CAMEL-20803: camel-spring-rabbitmq - Configuring maximumRetryAttempts
should accept 0
---
.../org/apache/camel/catalog/components/spring-rabbitmq.json | 2 +-
.../apache/camel/component/springrabbit/spring-rabbitmq.json | 2 +-
.../springrabbit/DefaultListenerContainerFactory.java | 5 ++++-
.../camel/component/springrabbit/SpringRabbitMQEndpoint.java | 2 +-
.../endpoint/dsl/SpringRabbitMQEndpointBuilderFactory.java | 10 ++++++----
.../org/apache/camel/kotlin/components/SpringRabbitmqUriDsl.kt | 8 ++++----
6 files changed, 17 insertions(+), 12 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/spring-rabbitmq.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/spring-rabbitmq.json
index 3bd85849ae9..d76ff93530a 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/spring-rabbitmq.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/spring-rabbitmq.json
@@ -94,7 +94,7 @@
"autoStartup": { "index": 13, "kind": "parameter", "displayName": "Auto
Startup", "group": "consumer", "label": "consumer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Specifies whether the
consumer container should auto-startup." },
"exchangeType": { "index": 14, "kind": "parameter", "displayName":
"Exchange Type", "group": "consumer", "label": "consumer", "required": false,
"type": "string", "javaType": "java.lang.String", "enum": [ "direct", "fanout",
"headers", "topic" ], "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "direct", "description": "The type of the exchange" },
"exclusive": { "index": 15, "kind": "parameter", "displayName":
"Exclusive", "group": "consumer", "label": "consumer", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": false, "description": "Set to true for
an exclusive consumer" },
- "maximumRetryAttempts": { "index": 16, "kind": "parameter", "displayName":
"Maximum Retry Attempts", "group": "consumer", "label": "consumer", "required":
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": 5, "description": "How many times a
Rabbitmq consumer will retry the same message if Camel failed to process the
message" },
+ "maximumRetryAttempts": { "index": 16, "kind": "parameter", "displayName":
"Maximum Retry Attempts", "group": "consumer", "label": "consumer", "required":
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": 5, "description": "How many times a
Rabbitmq consumer will try the same message if Camel failed to process the
message (The number of attempts includes the initial try)" },
"noLocal": { "index": 17, "kind": "parameter", "displayName": "No Local",
"group": "consumer", "label": "consumer", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "autowired": false, "secret":
false, "defaultValue": false, "description": "Set to true for an no-local
consumer" },
"rejectAndDontRequeue": { "index": 18, "kind": "parameter", "displayName":
"Reject And Dont Requeue", "group": "consumer", "label": "consumer",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": true,
"description": "Whether a Rabbitmq consumer should reject the message without
requeuing. This enables failed messages to be sent to a Dead Letter
Exchange\/Queue, if the broker is so configured." },
"retryDelay": { "index": 19, "kind": "parameter", "displayName": "Retry
Delay", "group": "consumer", "label": "consumer", "required": false, "type":
"integer", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 1000, "description": "Delay in millis a
Rabbitmq consumer will wait before redelivering a message that Camel failed to
process" },
diff --git
a/components/camel-spring-rabbitmq/src/generated/resources/META-INF/org/apache/camel/component/springrabbit/spring-rabbitmq.json
b/components/camel-spring-rabbitmq/src/generated/resources/META-INF/org/apache/camel/component/springrabbit/spring-rabbitmq.json
index 3bd85849ae9..d76ff93530a 100644
---
a/components/camel-spring-rabbitmq/src/generated/resources/META-INF/org/apache/camel/component/springrabbit/spring-rabbitmq.json
+++
b/components/camel-spring-rabbitmq/src/generated/resources/META-INF/org/apache/camel/component/springrabbit/spring-rabbitmq.json
@@ -94,7 +94,7 @@
"autoStartup": { "index": 13, "kind": "parameter", "displayName": "Auto
Startup", "group": "consumer", "label": "consumer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Specifies whether the
consumer container should auto-startup." },
"exchangeType": { "index": 14, "kind": "parameter", "displayName":
"Exchange Type", "group": "consumer", "label": "consumer", "required": false,
"type": "string", "javaType": "java.lang.String", "enum": [ "direct", "fanout",
"headers", "topic" ], "deprecated": false, "autowired": false, "secret": false,
"defaultValue": "direct", "description": "The type of the exchange" },
"exclusive": { "index": 15, "kind": "parameter", "displayName":
"Exclusive", "group": "consumer", "label": "consumer", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": false, "description": "Set to true for
an exclusive consumer" },
- "maximumRetryAttempts": { "index": 16, "kind": "parameter", "displayName":
"Maximum Retry Attempts", "group": "consumer", "label": "consumer", "required":
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": 5, "description": "How many times a
Rabbitmq consumer will retry the same message if Camel failed to process the
message" },
+ "maximumRetryAttempts": { "index": 16, "kind": "parameter", "displayName":
"Maximum Retry Attempts", "group": "consumer", "label": "consumer", "required":
false, "type": "integer", "javaType": "int", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": 5, "description": "How many times a
Rabbitmq consumer will try the same message if Camel failed to process the
message (The number of attempts includes the initial try)" },
"noLocal": { "index": 17, "kind": "parameter", "displayName": "No Local",
"group": "consumer", "label": "consumer", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "autowired": false, "secret":
false, "defaultValue": false, "description": "Set to true for an no-local
consumer" },
"rejectAndDontRequeue": { "index": 18, "kind": "parameter", "displayName":
"Reject And Dont Requeue", "group": "consumer", "label": "consumer",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": true,
"description": "Whether a Rabbitmq consumer should reject the message without
requeuing. This enables failed messages to be sent to a Dead Letter
Exchange\/Queue, if the broker is so configured." },
"retryDelay": { "index": 19, "kind": "parameter", "displayName": "Retry
Delay", "group": "consumer", "label": "consumer", "required": false, "type":
"integer", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 1000, "description": "Delay in millis a
Rabbitmq consumer will wait before redelivering a message that Camel failed to
process" },
diff --git
a/components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/DefaultListenerContainerFactory.java
b/components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/DefaultListenerContainerFactory.java
index b20feab740f..ee92c6e03c1 100644
---
a/components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/DefaultListenerContainerFactory.java
+++
b/components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/DefaultListenerContainerFactory.java
@@ -22,6 +22,7 @@ import org.springframework.amqp.rabbit.core.RabbitAdmin;
import
org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer;
import org.springframework.amqp.rabbit.retry.RejectAndDontRequeueRecoverer;
import org.springframework.retry.backoff.FixedBackOffPolicy;
+import org.springframework.retry.policy.NeverRetryPolicy;
import org.springframework.retry.policy.SimpleRetryPolicy;
import static
org.apache.camel.component.springrabbit.SpringRabbitMQConstants.*;
@@ -70,7 +71,9 @@ public class DefaultListenerContainerFactory implements
ListenerContainerFactory
listener.setAdviceChain(endpoint.getRetry());
} else {
RetryInterceptorBuilder<?, ?> builder =
RetryInterceptorBuilder.stateless();
- if (endpoint.getMaximumRetryAttempts() > 0) {
+ if (endpoint.getMaximumRetryAttempts() <= 0) {
+ builder.retryPolicy(new NeverRetryPolicy());
+ } else if (endpoint.getMaximumRetryAttempts() > 0) {
builder.retryPolicy(new
SimpleRetryPolicy(endpoint.getMaximumRetryAttempts()));
}
if (endpoint.getRetryDelay() > 0) {
diff --git
a/components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/SpringRabbitMQEndpoint.java
b/components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/SpringRabbitMQEndpoint.java
index 20efa25834b..40638e87084 100644
---
a/components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/SpringRabbitMQEndpoint.java
+++
b/components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/SpringRabbitMQEndpoint.java
@@ -184,7 +184,7 @@ public class SpringRabbitMQEndpoint extends DefaultEndpoint
implements AsyncEndp
+ "If this is
configured then the other settings such as maximumRetryAttempts for retry are
not in use.")
private RetryOperationsInterceptor retry;
@UriParam(label = "consumer", defaultValue = "5",
- description = "How many times a Rabbitmq consumer will retry the
same message if Camel failed to process the message")
+ description = "How many times a Rabbitmq consumer will try the
same message if Camel failed to process the message (The number of attempts
includes the initial try)")
private int maximumRetryAttempts = 5;
@UriParam(label = "consumer", defaultValue = "1000",
description = "Delay in millis a Rabbitmq consumer will wait
before redelivering a message that Camel failed to process")
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SpringRabbitMQEndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SpringRabbitMQEndpointBuilderFactory.java
index 1b356d67d0a..87c74ac142c 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SpringRabbitMQEndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SpringRabbitMQEndpointBuilderFactory.java
@@ -454,8 +454,9 @@ public interface SpringRabbitMQEndpointBuilderFactory {
return this;
}
/**
- * How many times a Rabbitmq consumer will retry the same message if
- * Camel failed to process the message.
+ * How many times a Rabbitmq consumer will try the same message if
Camel
+ * failed to process the message (The number of attempts includes the
+ * initial try).
*
* The option is a: <code>int</code> type.
*
@@ -470,8 +471,9 @@ public interface SpringRabbitMQEndpointBuilderFactory {
return this;
}
/**
- * How many times a Rabbitmq consumer will retry the same message if
- * Camel failed to process the message.
+ * How many times a Rabbitmq consumer will try the same message if
Camel
+ * failed to process the message (The number of attempts includes the
+ * initial try).
*
* The option will be converted to a <code>int</code> type.
*
diff --git
a/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/SpringRabbitmqUriDsl.kt
b/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/SpringRabbitmqUriDsl.kt
index ef6fb140612..72e52b36530 100644
---
a/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/SpringRabbitmqUriDsl.kt
+++
b/dsl/camel-kotlin-api/src/generated/kotlin/org/apache/camel/kotlin/components/SpringRabbitmqUriDsl.kt
@@ -239,16 +239,16 @@ public class SpringRabbitmqUriDsl(
}
/**
- * How many times a Rabbitmq consumer will retry the same message if Camel
failed to process the
- * message
+ * How many times a Rabbitmq consumer will try the same message if Camel
failed to process the
+ * message (The number of attempts includes the initial try)
*/
public fun maximumRetryAttempts(maximumRetryAttempts: String) {
it.property("maximumRetryAttempts", maximumRetryAttempts)
}
/**
- * How many times a Rabbitmq consumer will retry the same message if Camel
failed to process the
- * message
+ * How many times a Rabbitmq consumer will try the same message if Camel
failed to process the
+ * message (The number of attempts includes the initial try)
*/
public fun maximumRetryAttempts(maximumRetryAttempts: Int) {
it.property("maximumRetryAttempts", maximumRetryAttempts.toString())