This is an automated email from the ASF dual-hosted git repository.
janbednar 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 8063161 CAMEL-15113: Rabbitmq added skipDlqDeclare option. Extended
args with dlq.queue and dlq.binding prefixes (#3985)
8063161 is described below
commit 806316150d518068ee86991d70b20841b1111242
Author: Jan Bednar <[email protected]>
AuthorDate: Thu Jul 9 10:48:35 2020 +0200
CAMEL-15113: Rabbitmq added skipDlqDeclare option. Extended args with
dlq.queue and dlq.binding prefixes (#3985)
---
.../apache/camel/catalog/components/rabbitmq.json | 5 +-
.../camel/catalog/docs/rabbitmq-component.adoc | 7 +-
.../rabbitmq/RabbitMQEndpointConfigurer.java | 5 +
.../apache/camel/component/rabbitmq/rabbitmq.json | 5 +-
.../src/main/docs/rabbitmq-component.adoc | 7 +-
.../component/rabbitmq/RabbitMQComponent.java | 4 +
.../component/rabbitmq/RabbitMQDeclareSupport.java | 7 +-
.../camel/component/rabbitmq/RabbitMQEndpoint.java | 27 ++++
.../component/rabbitmq/RabbitMQEndpointTest.java | 13 +-
.../integration/RabbitMQDeadLetterArgsIntTest.java | 137 +++++++++++++++++++++
.../dsl/RabbitmqComponentBuilderFactory.java | 5 +-
.../dsl/RabbitMQEndpointBuilderFactory.java | 130 +++++++++++++++++--
.../modules/ROOT/pages/rabbitmq-component.adoc | 7 +-
13 files changed, 324 insertions(+), 35 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/rabbitmq.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/rabbitmq.json
index f54fe68..75f1117 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/rabbitmq.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/rabbitmq.json
@@ -55,7 +55,7 @@
"mandatory": { "kind": "property", "displayName": "Mandatory", "group":
"producer", "label": "producer", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "secret": false, "defaultValue":
false, "description": "This flag tells the server how to react if the message
cannot be routed to a queue. If this flag is set, the server will return an
unroutable message with a Return method. If this flag is zero, the server
silently drops the message. If the heade [...]
"publisherAcknowledgements": { "kind": "property", "displayName":
"Publisher Acknowledgements", "group": "producer", "label": "producer",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "secret": false, "defaultValue": false, "description": "When true, the
message will be published with publisher acknowledgements turned on" },
"publisherAcknowledgementsTimeout": { "kind": "property", "displayName":
"Publisher Acknowledgements Timeout", "group": "producer", "label": "producer",
"required": false, "type": "integer", "javaType": "long", "deprecated": false,
"secret": false, "description": "The amount of time in milliseconds to wait for
a basic.ack response from RabbitMQ server" },
- "args": { "kind": "property", "displayName": "Args", "group": "advanced",
"label": "advanced", "required": false, "type": "object", "javaType":
"java.util.Map<java.lang.String, java.lang.Object>", "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
queue with message ttl argument: http:\/ [...]
+ "args": { "kind": "property", "displayName": "Args", "group": "advanced",
"label": "advanced", "required": false, "type": "object", "javaType":
"java.util.Map<java.lang.String, java.lang.Object>", "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. DLQ: arg.dlq.queue. DLQ
Binding: arg.dlq.binding. For example to [...]
"autoDetectConnectionFactory": { "kind": "property", "displayName": "Auto
Detect Connection Factory", "group": "advanced", "label": "advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "secret": false, "defaultValue": "true", "description": "Whether to
auto-detect looking up RabbitMQ connection factory from the registry. When
enabled and a single instance of the connection factory is found then it will
be used. An explicit connection factory c [...]
"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" },
@@ -94,6 +94,7 @@
"portNumber": { "kind": "parameter", "displayName": "Port Number",
"group": "common", "label": "common", "required": false, "type": "integer",
"javaType": "int", "deprecated": false, "secret": false, "description": "Port
number for the host with the running rabbitmq instance or cluster. Default
value is 5672." },
"queue": { "kind": "parameter", "displayName": "Queue", "group": "common",
"label": "common", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "secret": false, "description": "The
queue to receive messages from" },
"routingKey": { "kind": "parameter", "displayName": "Routing Key",
"group": "common", "label": "common", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "secret": false,
"description": "The routing key to use when binding a consumer queue to the
exchange. For producer routing keys, you set the header rabbitmq.ROUTING_KEY."
},
+ "skipDlqDeclare": { "kind": "parameter", "displayName": "Skip Dlq
Declare", "group": "common", "label": "common", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "secret": false,
"defaultValue": false, "description": "If true the producer will not declare
and bind a dead letter queue. This can be used if you have also DLQ rabbitmq
consumer and you want to avoid argument clashing between Producer and Consumer.
This option have no effect, if DLQ config [...]
"skipExchangeDeclare": { "kind": "parameter", "displayName": "Skip
Exchange Declare", "group": "common", "label": "common", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false,
"defaultValue": false, "description": "This can be used if we need to declare
the queue but not the exchange" },
"skipQueueBind": { "kind": "parameter", "displayName": "Skip Queue Bind",
"group": "common", "label": "common", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "secret": false, "defaultValue":
false, "description": "If true the queue will not be bound to the exchange
after declaring it" },
"skipQueueDeclare": { "kind": "parameter", "displayName": "Skip Queue
Declare", "group": "common", "label": "common", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "secret": false,
"defaultValue": false, "description": "If true the producer will not declare
and bind a queue. This can be used for directing messages via an existing
routing key." },
@@ -121,7 +122,7 @@
"mandatory": { "kind": "parameter", "displayName": "Mandatory", "group":
"producer", "label": "producer", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "secret": false, "defaultValue":
false, "description": "This flag tells the server how to react if the message
cannot be routed to a queue. If this flag is set, the server will return an
unroutable message with a Return method. If this flag is zero, the server
silently drops the message. If the head [...]
"publisherAcknowledgements": { "kind": "parameter", "displayName":
"Publisher Acknowledgements", "group": "producer", "label": "producer",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "secret": false, "defaultValue": false, "description": "When true, the
message will be published with publisher acknowledgements turned on" },
"publisherAcknowledgementsTimeout": { "kind": "parameter", "displayName":
"Publisher Acknowledgements Timeout", "group": "producer", "label": "producer",
"required": false, "type": "integer", "javaType": "long", "deprecated": false,
"secret": false, "description": "The amount of time in milliseconds to wait for
a basic.ack response from RabbitMQ server" },
- "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 [...]
+ "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. DLQ: arg.dlq.queue. DLQ bi [...]
"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" },
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/rabbitmq-component.adoc
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/rabbitmq-component.adoc
index de2d8a4..99ed4b7 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/rabbitmq-component.adoc
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/rabbitmq-component.adoc
@@ -97,7 +97,7 @@ The RabbitMQ component supports 53 options, which are listed
below.
| *mandatory* (producer) | This flag tells the server how to react if the
message cannot be routed to a queue. If this flag is set, the server will
return an unroutable message with a Return method. If this flag is zero, the
server silently drops the message. If the header is present rabbitmq.MANDATORY
it will override this option. | false | boolean
| *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
+| *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. DLQ: arg.dlq.queue. DLQ Binding:
arg.dlq.binding. For example to declare a queue with message ttl argument:
\http://localhost:5672/exchange/queueargs=arg.queue.x-message-ttl=60000 | | Map
| *autoDetectConnectionFactory* (advanced) | Whether to auto-detect looking up
RabbitMQ connection factory from the registry. When enabled and a single
instance of the connection factory is found then it will be used. An explicit
connection factory can be configured on the component or endpoint level which
takes precedence. | true | boolean
| *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
@@ -139,7 +139,7 @@ with the following path and query parameters:
|===
-=== Query Parameters (63 parameters):
+=== Query Parameters (64 parameters):
[width="100%",cols="2,5,^1,2",options="header"]
@@ -162,6 +162,7 @@ with the following path and query parameters:
| *portNumber* (common) | Port number for the host with the running rabbitmq
instance or cluster. Default value is 5672. | | int
| *queue* (common) | The queue to receive messages from | | String
| *routingKey* (common) | The routing key to use when binding a consumer queue
to the exchange. For producer routing keys, you set the header
rabbitmq.ROUTING_KEY. | | String
+| *skipDlqDeclare* (common) | If true the producer will not declare and bind a
dead letter queue. This can be used if you have also DLQ rabbitmq consumer and
you want to avoid argument clashing between Producer and Consumer. This option
have no effect, if DLQ configured (deadLetterExchange option is not set). |
false | boolean
| *skipExchangeDeclare* (common) | This can be used if we need to declare the
queue but not the exchange | false | boolean
| *skipQueueBind* (common) | If true the queue will not be bound to the
exchange after declaring it | false | boolean
| *skipQueueDeclare* (common) | If true the producer will not declare and bind
a queue. This can be used for directing messages via an existing routing key. |
false | boolean
@@ -189,7 +190,7 @@ with the following path and query parameters:
| *mandatory* (producer) | This flag tells the server how to react if the
message cannot be routed to a queue. If this flag is set, the server will
return an unroutable message with a Return method. If this flag is zero, the
server silently drops the message. If the header is present rabbitmq.MANDATORY
it will override this option. | false | boolean
| *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
+| *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. DLQ: arg.dlq.queue. DLQ binding:
arg.dlq.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
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 f750b77..a6feecb 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
@@ -112,6 +112,8 @@ public class RabbitMQEndpointConfigurer extends
PropertyConfigurerSupport implem
case "requestedHeartbeat":
target.setRequestedHeartbeat(property(camelContext, int.class, value)); return
true;
case "routingkey":
case "routingKey": target.setRoutingKey(property(camelContext,
java.lang.String.class, value)); return true;
+ case "skipdlqdeclare":
+ case "skipDlqDeclare": target.setSkipDlqDeclare(property(camelContext,
boolean.class, value)); return true;
case "skipexchangedeclare":
case "skipExchangeDeclare":
target.setSkipExchangeDeclare(property(camelContext, boolean.class, value));
return true;
case "skipqueuebind":
@@ -190,6 +192,7 @@ public class RabbitMQEndpointConfigurer extends
PropertyConfigurerSupport implem
answer.put("requestedFrameMax", int.class);
answer.put("requestedHeartbeat", int.class);
answer.put("routingKey", java.lang.String.class);
+ answer.put("skipDlqDeclare", boolean.class);
answer.put("skipExchangeDeclare", boolean.class);
answer.put("skipQueueBind", boolean.class);
answer.put("skipQueueDeclare", boolean.class);
@@ -301,6 +304,8 @@ public class RabbitMQEndpointConfigurer extends
PropertyConfigurerSupport implem
case "requestedHeartbeat": return target.getRequestedHeartbeat();
case "routingkey":
case "routingKey": return target.getRoutingKey();
+ case "skipdlqdeclare":
+ case "skipDlqDeclare": return target.isSkipDlqDeclare();
case "skipexchangedeclare":
case "skipExchangeDeclare": return target.isSkipExchangeDeclare();
case "skipqueuebind":
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 f54fe68..75f1117 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
@@ -55,7 +55,7 @@
"mandatory": { "kind": "property", "displayName": "Mandatory", "group":
"producer", "label": "producer", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "secret": false, "defaultValue":
false, "description": "This flag tells the server how to react if the message
cannot be routed to a queue. If this flag is set, the server will return an
unroutable message with a Return method. If this flag is zero, the server
silently drops the message. If the heade [...]
"publisherAcknowledgements": { "kind": "property", "displayName":
"Publisher Acknowledgements", "group": "producer", "label": "producer",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "secret": false, "defaultValue": false, "description": "When true, the
message will be published with publisher acknowledgements turned on" },
"publisherAcknowledgementsTimeout": { "kind": "property", "displayName":
"Publisher Acknowledgements Timeout", "group": "producer", "label": "producer",
"required": false, "type": "integer", "javaType": "long", "deprecated": false,
"secret": false, "description": "The amount of time in milliseconds to wait for
a basic.ack response from RabbitMQ server" },
- "args": { "kind": "property", "displayName": "Args", "group": "advanced",
"label": "advanced", "required": false, "type": "object", "javaType":
"java.util.Map<java.lang.String, java.lang.Object>", "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
queue with message ttl argument: http:\/ [...]
+ "args": { "kind": "property", "displayName": "Args", "group": "advanced",
"label": "advanced", "required": false, "type": "object", "javaType":
"java.util.Map<java.lang.String, java.lang.Object>", "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. DLQ: arg.dlq.queue. DLQ
Binding: arg.dlq.binding. For example to [...]
"autoDetectConnectionFactory": { "kind": "property", "displayName": "Auto
Detect Connection Factory", "group": "advanced", "label": "advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "secret": false, "defaultValue": "true", "description": "Whether to
auto-detect looking up RabbitMQ connection factory from the registry. When
enabled and a single instance of the connection factory is found then it will
be used. An explicit connection factory c [...]
"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" },
@@ -94,6 +94,7 @@
"portNumber": { "kind": "parameter", "displayName": "Port Number",
"group": "common", "label": "common", "required": false, "type": "integer",
"javaType": "int", "deprecated": false, "secret": false, "description": "Port
number for the host with the running rabbitmq instance or cluster. Default
value is 5672." },
"queue": { "kind": "parameter", "displayName": "Queue", "group": "common",
"label": "common", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "secret": false, "description": "The
queue to receive messages from" },
"routingKey": { "kind": "parameter", "displayName": "Routing Key",
"group": "common", "label": "common", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "secret": false,
"description": "The routing key to use when binding a consumer queue to the
exchange. For producer routing keys, you set the header rabbitmq.ROUTING_KEY."
},
+ "skipDlqDeclare": { "kind": "parameter", "displayName": "Skip Dlq
Declare", "group": "common", "label": "common", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "secret": false,
"defaultValue": false, "description": "If true the producer will not declare
and bind a dead letter queue. This can be used if you have also DLQ rabbitmq
consumer and you want to avoid argument clashing between Producer and Consumer.
This option have no effect, if DLQ config [...]
"skipExchangeDeclare": { "kind": "parameter", "displayName": "Skip
Exchange Declare", "group": "common", "label": "common", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false,
"defaultValue": false, "description": "This can be used if we need to declare
the queue but not the exchange" },
"skipQueueBind": { "kind": "parameter", "displayName": "Skip Queue Bind",
"group": "common", "label": "common", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "secret": false, "defaultValue":
false, "description": "If true the queue will not be bound to the exchange
after declaring it" },
"skipQueueDeclare": { "kind": "parameter", "displayName": "Skip Queue
Declare", "group": "common", "label": "common", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "secret": false,
"defaultValue": false, "description": "If true the producer will not declare
and bind a queue. This can be used for directing messages via an existing
routing key." },
@@ -121,7 +122,7 @@
"mandatory": { "kind": "parameter", "displayName": "Mandatory", "group":
"producer", "label": "producer", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "secret": false, "defaultValue":
false, "description": "This flag tells the server how to react if the message
cannot be routed to a queue. If this flag is set, the server will return an
unroutable message with a Return method. If this flag is zero, the server
silently drops the message. If the head [...]
"publisherAcknowledgements": { "kind": "parameter", "displayName":
"Publisher Acknowledgements", "group": "producer", "label": "producer",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "secret": false, "defaultValue": false, "description": "When true, the
message will be published with publisher acknowledgements turned on" },
"publisherAcknowledgementsTimeout": { "kind": "parameter", "displayName":
"Publisher Acknowledgements Timeout", "group": "producer", "label": "producer",
"required": false, "type": "integer", "javaType": "long", "deprecated": false,
"secret": false, "description": "The amount of time in milliseconds to wait for
a basic.ack response from RabbitMQ server" },
- "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 [...]
+ "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. DLQ: arg.dlq.queue. DLQ bi [...]
"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" },
diff --git a/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc
b/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc
index de2d8a4..99ed4b7 100644
--- a/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc
+++ b/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc
@@ -97,7 +97,7 @@ The RabbitMQ component supports 53 options, which are listed
below.
| *mandatory* (producer) | This flag tells the server how to react if the
message cannot be routed to a queue. If this flag is set, the server will
return an unroutable message with a Return method. If this flag is zero, the
server silently drops the message. If the header is present rabbitmq.MANDATORY
it will override this option. | false | boolean
| *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
+| *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. DLQ: arg.dlq.queue. DLQ Binding:
arg.dlq.binding. For example to declare a queue with message ttl argument:
\http://localhost:5672/exchange/queueargs=arg.queue.x-message-ttl=60000 | | Map
| *autoDetectConnectionFactory* (advanced) | Whether to auto-detect looking up
RabbitMQ connection factory from the registry. When enabled and a single
instance of the connection factory is found then it will be used. An explicit
connection factory can be configured on the component or endpoint level which
takes precedence. | true | boolean
| *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
@@ -139,7 +139,7 @@ with the following path and query parameters:
|===
-=== Query Parameters (63 parameters):
+=== Query Parameters (64 parameters):
[width="100%",cols="2,5,^1,2",options="header"]
@@ -162,6 +162,7 @@ with the following path and query parameters:
| *portNumber* (common) | Port number for the host with the running rabbitmq
instance or cluster. Default value is 5672. | | int
| *queue* (common) | The queue to receive messages from | | String
| *routingKey* (common) | The routing key to use when binding a consumer queue
to the exchange. For producer routing keys, you set the header
rabbitmq.ROUTING_KEY. | | String
+| *skipDlqDeclare* (common) | If true the producer will not declare and bind a
dead letter queue. This can be used if you have also DLQ rabbitmq consumer and
you want to avoid argument clashing between Producer and Consumer. This option
have no effect, if DLQ configured (deadLetterExchange option is not set). |
false | boolean
| *skipExchangeDeclare* (common) | This can be used if we need to declare the
queue but not the exchange | false | boolean
| *skipQueueBind* (common) | If true the queue will not be bound to the
exchange after declaring it | false | boolean
| *skipQueueDeclare* (common) | If true the producer will not declare and bind
a queue. This can be used for directing messages via an existing routing key. |
false | boolean
@@ -189,7 +190,7 @@ with the following path and query parameters:
| *mandatory* (producer) | This flag tells the server how to react if the
message cannot be routed to a queue. If this flag is set, the server will
return an unroutable message with a Return method. If this flag is zero, the
server silently drops the message. If the header is present rabbitmq.MANDATORY
it will override this option. | false | boolean
| *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
+| *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. DLQ: arg.dlq.queue. DLQ binding:
arg.dlq.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
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 a63bf95..6929772 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
@@ -38,6 +38,8 @@ public class RabbitMQComponent extends DefaultComponent {
public static final String ARG_PREFIX = "arg.";
public static final String EXCHANGE_ARG_PREFIX = "exchange.";
public static final String QUEUE_ARG_PREFIX = "queue.";
+ public static final String DLQ_ARG_PREFIX = "dlq.queue.";
+ public static final String DLQ_BINDING_PREFIX = "dlq.binding.";
public static final String BINDING_ARG_PREFIX = "binding.";
private static final Logger LOG =
LoggerFactory.getLogger(RabbitMQComponent.class);
@@ -655,6 +657,8 @@ public class RabbitMQComponent extends DefaultComponent {
* <li>Exchange: arg.exchange.</li>
* <li>Queue: arg.queue.</li>
* <li>Binding: arg.binding.</li>
+ * <li>DLQ: arg.dlq.queue.</li>
+ * <li>DLQ Binding: arg.dlq.binding.</li>
* </ul>
* For example to declare a queue with message ttl argument:
* http://localhost:5672/exchange/queue?args=arg.queue.x-message-ttl=60000
diff --git
a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQDeclareSupport.java
b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQDeclareSupport.java
index 23324a2..06c1021 100644
---
a/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQDeclareSupport.java
+++
b/components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQDeclareSupport.java
@@ -37,10 +37,11 @@ public class RabbitMQDeclareSupport {
}
private void declareAndBindDeadLetterExchangeWithQueue(final Channel
channel) throws IOException {
- if (endpoint.getDeadLetterExchange() != null) {
- // TODO Do we need to setup the args for the DeadLetter?
+ if (endpoint.getDeadLetterExchange() != null &&
!endpoint.isSkipDlqDeclare()) {
+ Map<String, Object> queueArgs = new
HashMap<>(endpoint.getDlqArgs());
+ formatSpecialQueueArguments(queueArgs);
declareExchange(channel, endpoint.getDeadLetterExchange(),
endpoint.getDeadLetterExchangeType(), Collections.<String, Object> emptyMap());
- declareAndBindQueue(channel, endpoint.getDeadLetterQueue(),
endpoint.getDeadLetterExchange(), endpoint.getDeadLetterRoutingKey(), null,
null);
+ declareAndBindQueue(channel, endpoint.getDeadLetterQueue(),
endpoint.getDeadLetterExchange(), endpoint.getDeadLetterRoutingKey(),
queueArgs, endpoint.getDlqBindingArgs());
}
}
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 ebdcd51..f1ef970 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
@@ -47,6 +47,8 @@ import org.apache.camel.util.PropertiesHelper;
import org.apache.camel.util.URISupport;
import static
org.apache.camel.component.rabbitmq.RabbitMQComponent.BINDING_ARG_PREFIX;
+import static
org.apache.camel.component.rabbitmq.RabbitMQComponent.DLQ_ARG_PREFIX;
+import static
org.apache.camel.component.rabbitmq.RabbitMQComponent.DLQ_BINDING_PREFIX;
import static
org.apache.camel.component.rabbitmq.RabbitMQComponent.EXCHANGE_ARG_PREFIX;
import static
org.apache.camel.component.rabbitmq.RabbitMQComponent.QUEUE_ARG_PREFIX;
@@ -100,6 +102,8 @@ public class RabbitMQEndpoint extends DefaultEndpoint
implements AsyncEndpoint {
@UriParam(label = "common")
private boolean skipQueueBind;
@UriParam(label = "common")
+ private boolean skipDlqDeclare;
+ @UriParam(label = "common")
private boolean skipExchangeDeclare;
@UriParam(label = "common")
private String addresses;
@@ -426,6 +430,19 @@ public class RabbitMQEndpoint extends DefaultEndpoint
implements AsyncEndpoint {
}
/**
+ * If true the producer will not declare and bind a dead letter queue.
This can be used
+ * if you have also DLQ rabbitmq consumer and you want to avoid argument
clashing between Producer and Consumer.
+ * This option have no effect, if DLQ configured (deadLetterExchange
option is not set).
+ */
+ public void setSkipDlqDeclare(boolean skipDlqDeclare) {
+ this.skipDlqDeclare = skipDlqDeclare;
+ }
+
+ public boolean isSkipDlqDeclare() {
+ return skipDlqDeclare;
+ }
+
+ /**
* If true the queue will not be bound to the exchange after declaring it
*/
public boolean isSkipQueueBind() {
@@ -809,6 +826,8 @@ public class RabbitMQEndpoint extends DefaultEndpoint
implements AsyncEndpoint {
* <li>Exchange: arg.exchange.</li>
* <li>Queue: arg.queue.</li>
* <li>Binding: arg.binding.</li>
+ * <li>DLQ: arg.dlq.queue.</li>
+ * <li>DLQ binding: arg.dlq.binding.</li>
* </ul>
* For example to declare a queue with message ttl argument:
* http://localhost:5672/exchange/queue?args=arg.queue.x-message-ttl=60000
@@ -829,6 +848,14 @@ public class RabbitMQEndpoint extends DefaultEndpoint
implements AsyncEndpoint {
return PropertiesHelper.extractProperties(args, QUEUE_ARG_PREFIX,
false);
}
+ public Map<String, Object> getDlqArgs() {
+ return PropertiesHelper.extractProperties(args, DLQ_ARG_PREFIX, false);
+ }
+
+ public Map<String, Object> getDlqBindingArgs() {
+ return PropertiesHelper.extractProperties(args, DLQ_BINDING_PREFIX,
false);
+ }
+
public Map<String, Object> getBindingArgs() {
return PropertiesHelper.extractProperties(args, BINDING_ARG_PREFIX,
false);
}
diff --git
a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQEndpointTest.java
b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQEndpointTest.java
index 3fdb624..eacc87a 100644
---
a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQEndpointTest.java
+++
b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQEndpointTest.java
@@ -167,12 +167,15 @@ public class RabbitMQEndpointTest extends
CamelTestSupport {
@Test
public void testMultiArgsPopulateCorrectEndpointProperties() throws
Exception {
- RabbitMQEndpoint endpoint =
context.getEndpoint("rabbitmq:localhost/exchange?arg.exchange.e1=v1&arg.exchange.e2=v2&arg.queue.q1=v3&arg.binding.b1=v4",
+ RabbitMQEndpoint endpoint = context.getEndpoint(
+
"rabbitmq:localhost/exchange?arg.exchange.e1=v1&arg.exchange.e2=v2&arg.queue.q1=v3&arg.binding.b1=v4&arg.dlq.queue.dq1=v5&arg.dlq.binding.db1=v6",
RabbitMQEndpoint.class);
- assertEquals("Wrong number of args", 4, endpoint.getArgs().size());
- assertEquals("Wrong number of args", 1,
endpoint.getBindingArgs().size());
- assertEquals("Wrong number of args", 2,
endpoint.getExchangeArgs().size());
- assertEquals("Wrong number of args", 1,
endpoint.getQueueArgs().size());
+ assertEquals("Wrong number of args", 6, endpoint.getArgs().size());
+ assertEquals("Wrong number of args (binding)", 1,
endpoint.getBindingArgs().size());
+ assertEquals("Wrong number of args (exchange)", 2,
endpoint.getExchangeArgs().size());
+ assertEquals("Wrong number of args (queue)", 1,
endpoint.getQueueArgs().size());
+ assertEquals("Wrong number of args (dlq.queue)", 1,
endpoint.getDlqArgs().size());
+ assertEquals("Wrong number of args (dlq.binding)", 1,
endpoint.getDlqBindingArgs().size());
}
@Test
diff --git
a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQDeadLetterArgsIntTest.java
b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQDeadLetterArgsIntTest.java
new file mode 100644
index 0000000..fb3a052
--- /dev/null
+++
b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/integration/RabbitMQDeadLetterArgsIntTest.java
@@ -0,0 +1,137 @@
+/*
+ * 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.integration;
+
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.Predicate;
+
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Produce;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.rabbitmq.RabbitMQEndpoint;
+import org.apache.camel.util.json.JsonArray;
+import org.apache.camel.util.json.JsonObject;
+import org.apache.camel.util.json.Jsoner;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class RabbitMQDeadLetterArgsIntTest extends AbstractRabbitMQIntTest {
+ private static final String LOCAL_RABBITMQ_PARAMS =
"hostname=localhost&portNumber=5672&username=cameltest&password=cameltest";
+ private static final String QUEUE = "queue";
+ private static final String DLQ = QUEUE + "_dlq";
+ private static final String QUEUE_SKIP_DECLARE = "queue_skip_declare";
+ private static final String DLQ_SKIP_DECLARE = QUEUE_SKIP_DECLARE + "_dlq";
+
+ @EndpointInject("mock:received_dlq")
+ private MockEndpoint receivedDlqEndpoint;
+
+ @EndpointInject("mock:received")
+ private MockEndpoint receivedEndpoint;
+
+ @Produce("direct:start")
+ private ProducerTemplate template;
+
+ @BindToRegistry("dlqArgs")
+ private Map<String, Object> dlqArgs = new HashMap<String, Object>() {
+ {
+ put("dlq.queue.x-max-priority", 10);
+ }
+ };
+
+ @BindToRegistry("args")
+ private Map<String, Object> args = new HashMap<String, Object>() {
+ {
+ put("queue.x-max-priority", 5);
+ }
+ };
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+
+ @Override
+ public void configure() {
+ final String endpointUri1 = String.format(
+
"rabbitmq:exchange?%s&queue=%s&deadLetterQueue=%s&autoAck=false&durable=true&args=#dlqArgs&deadLetterExchange=dlqexchange",
+ LOCAL_RABBITMQ_PARAMS, QUEUE, DLQ);
+ from("direct:start")
+ .to(endpointUri1);
+ fromF(endpointUri1)
+ .routeId("consumer")
+ .convertBodyTo(String.class)
+ .to(receivedEndpoint)
+ .throwException(new RuntimeException("Simulated"));
+
+ final String endpointUri2 = String.format(
+
"rabbitmq:anotherExchange?%s&queue=%s&deadLetterQueue=%s&autoAck=false&durable=true&deadLetterExchange=anotherExchange&skipDlqDeclare=true",
+ LOCAL_RABBITMQ_PARAMS, QUEUE_SKIP_DECLARE,
DLQ_SKIP_DECLARE);
+ from("direct:start_skip_dlq_declare")
+ .to(endpointUri2);
+ from(endpointUri2)
+ .throwException(new RuntimeException("Simulated"));
+ fromF("rabbitmq:anotherExchange?%s&queue=%s&args=#args",
LOCAL_RABBITMQ_PARAMS, DLQ_SKIP_DECLARE)
+ .convertBodyTo(String.class)
+ .to(receivedDlqEndpoint);
+ }
+ };
+ }
+
+ @Test
+ public void testDlq() throws Exception {
+ template.sendBody("direct:start_skip_dlq_declare", "Hi");
+ receivedDlqEndpoint.expectedMessageCount(1);
+ receivedDlqEndpoint.expectedBodiesReceived("Hi");
+
+ template.sendBody("direct:start", "Hello");
+
+ receivedEndpoint.expectedMinimumMessageCount(1);
+ receivedEndpoint.assertIsSatisfied();
+
+ RabbitMQEndpoint endpoint = (RabbitMQEndpoint)
context.getRoute("consumer").getEndpoint();
+ Assert.assertNotNull(endpoint.getDlqArgs());
+ Assert.assertEquals(10, endpoint.getDlqArgs().get("x-max-priority"));
+
+ String rabbitApiResponse = template.requestBody(
+
String.format("http://localhost:%s/api/queues?authUsername=cameltest&authPassword=cameltest&authMethod=Basic&httpMethod=GET",
DockerTestUtils.EXPOSE_PORT_MANAGEMENT),
+ "", String.class);
+
+ JsonArray rabbitApiResponseJson = (JsonArray)
Jsoner.deserialize(rabbitApiResponse);
+ JsonObject dlqObject = (JsonObject)
rabbitApiResponseJson.stream().filter(jsonQueueFilter(DLQ)).findAny().orElse(null);
+ JsonObject queueObject = (JsonObject)
rabbitApiResponseJson.stream().filter(jsonQueueFilter(QUEUE)).findAny().orElse(null);
+ JsonObject queueSkipDeclareObject = (JsonObject)
rabbitApiResponseJson.stream().filter(jsonQueueFilter(QUEUE_SKIP_DECLARE)).findAny().orElse(null);
+ JsonObject dlqSkipDeclareObject = (JsonObject)
rabbitApiResponseJson.stream().filter(jsonQueueFilter(DLQ_SKIP_DECLARE)).findAny().orElse(null);
+
+ Assert.assertNotNull(String.format("Queue with name '%s' not found in
REST API. API response was '%s'", DLQ, rabbitApiResponse), dlqObject);
+ Assert.assertNotNull(String.format("Queue with name '%s' not found in
REST API. API response was '%s'", QUEUE, rabbitApiResponse), queueObject);
+ Assert.assertNotNull(String.format("Queue with name '%s' not found in
REST API. API response was '%s'", QUEUE_SKIP_DECLARE, rabbitApiResponse),
queueObject);
+ Assert.assertNotNull(String.format("Queue with name '%s' not found in
REST API. API response was '%s'", DLQ_SKIP_DECLARE, rabbitApiResponse),
dlqSkipDeclareObject);
+
+ Assert.assertEquals(BigDecimal.valueOf(10),
dlqObject.getMap("arguments").get("x-max-priority"));
+ Assert.assertEquals(BigDecimal.valueOf(5),
dlqSkipDeclareObject.getMap("arguments").get("x-max-priority"));
+ Assert.assertEquals("dlqexchange",
queueObject.getMap("arguments").get("x-dead-letter-exchange"));
+ Assert.assertEquals("anotherExchange",
queueSkipDeclareObject.getMap("arguments").get("x-dead-letter-exchange"));
+ }
+
+ private Predicate<Object> jsonQueueFilter(String name) {
+ return o -> name.equals(((JsonObject) o).getString("name"));
+ }
+}
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 df3bddc..f891518 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
@@ -521,8 +521,9 @@ public interface RabbitmqComponentBuilderFactory {
/**
* 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:
+ * arg.queue. Binding: arg.binding. DLQ: arg.dlq.queue. DLQ Binding:
+ * arg.dlq.binding. For example to declare a queue with message ttl
+ * argument:
*
http://localhost:5672/exchange/queueargs=arg.queue.x-message-ttl=60000.
*
* The option is a: <code>java.util.Map<java.lang.String,
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 10bf6a0..e279ac8 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
@@ -368,6 +368,40 @@ public interface RabbitMQEndpointBuilderFactory {
return this;
}
/**
+ * If true the producer will not declare and bind a dead letter queue.
+ * This can be used if you have also DLQ rabbitmq consumer and you want
+ * to avoid argument clashing between Producer and Consumer. This
option
+ * have no effect, if DLQ configured (deadLetterExchange option is not
+ * set).
+ *
+ * The option is a: <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: common
+ */
+ default RabbitMQEndpointConsumerBuilder skipDlqDeclare(
+ boolean skipDlqDeclare) {
+ doSetProperty("skipDlqDeclare", skipDlqDeclare);
+ return this;
+ }
+ /**
+ * If true the producer will not declare and bind a dead letter queue.
+ * This can be used if you have also DLQ rabbitmq consumer and you want
+ * to avoid argument clashing between Producer and Consumer. This
option
+ * have no effect, if DLQ configured (deadLetterExchange option is not
+ * set).
+ *
+ * The option will be converted to a <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: common
+ */
+ default RabbitMQEndpointConsumerBuilder skipDlqDeclare(
+ String skipDlqDeclare) {
+ doSetProperty("skipDlqDeclare", skipDlqDeclare);
+ return this;
+ }
+ /**
* This can be used if we need to declare the queue but not the
* exchange.
*
@@ -909,8 +943,9 @@ public interface RabbitMQEndpointBuilderFactory {
/**
* 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:
+ * arg.queue. Binding: arg.binding. DLQ: arg.dlq.queue. DLQ binding:
+ * arg.dlq.binding. For example to declare a queue with message ttl
+ * argument:
*
http://localhost:5672/exchange/queueargs=arg.queue.x-message-ttl=60000.
*
* The option is a: <code>java.util.Map<java.lang.String,
@@ -930,8 +965,9 @@ public interface RabbitMQEndpointBuilderFactory {
/**
* 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:
+ * arg.queue. Binding: arg.binding. DLQ: arg.dlq.queue. DLQ binding:
+ * arg.dlq.binding. For example to declare a queue with message ttl
+ * argument:
*
http://localhost:5672/exchange/queueargs=arg.queue.x-message-ttl=60000.
*
* The option is a: <code>java.util.Map<java.lang.String,
@@ -1636,6 +1672,40 @@ public interface RabbitMQEndpointBuilderFactory {
return this;
}
/**
+ * If true the producer will not declare and bind a dead letter queue.
+ * This can be used if you have also DLQ rabbitmq consumer and you want
+ * to avoid argument clashing between Producer and Consumer. This
option
+ * have no effect, if DLQ configured (deadLetterExchange option is not
+ * set).
+ *
+ * The option is a: <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: common
+ */
+ default RabbitMQEndpointProducerBuilder skipDlqDeclare(
+ boolean skipDlqDeclare) {
+ doSetProperty("skipDlqDeclare", skipDlqDeclare);
+ return this;
+ }
+ /**
+ * If true the producer will not declare and bind a dead letter queue.
+ * This can be used if you have also DLQ rabbitmq consumer and you want
+ * to avoid argument clashing between Producer and Consumer. This
option
+ * have no effect, if DLQ configured (deadLetterExchange option is not
+ * set).
+ *
+ * The option will be converted to a <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: common
+ */
+ default RabbitMQEndpointProducerBuilder skipDlqDeclare(
+ String skipDlqDeclare) {
+ doSetProperty("skipDlqDeclare", skipDlqDeclare);
+ return this;
+ }
+ /**
* This can be used if we need to declare the queue but not the
* exchange.
*
@@ -2175,8 +2245,9 @@ public interface RabbitMQEndpointBuilderFactory {
/**
* 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:
+ * arg.queue. Binding: arg.binding. DLQ: arg.dlq.queue. DLQ binding:
+ * arg.dlq.binding. For example to declare a queue with message ttl
+ * argument:
*
http://localhost:5672/exchange/queueargs=arg.queue.x-message-ttl=60000.
*
* The option is a: <code>java.util.Map<java.lang.String,
@@ -2196,8 +2267,9 @@ public interface RabbitMQEndpointBuilderFactory {
/**
* 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:
+ * arg.queue. Binding: arg.binding. DLQ: arg.dlq.queue. DLQ binding:
+ * arg.dlq.binding. For example to declare a queue with message ttl
+ * argument:
*
http://localhost:5672/exchange/queueargs=arg.queue.x-message-ttl=60000.
*
* The option is a: <code>java.util.Map<java.lang.String,
@@ -2902,6 +2974,38 @@ public interface RabbitMQEndpointBuilderFactory {
return this;
}
/**
+ * If true the producer will not declare and bind a dead letter queue.
+ * This can be used if you have also DLQ rabbitmq consumer and you want
+ * to avoid argument clashing between Producer and Consumer. This
option
+ * have no effect, if DLQ configured (deadLetterExchange option is not
+ * set).
+ *
+ * The option is a: <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: common
+ */
+ default RabbitMQEndpointBuilder skipDlqDeclare(boolean skipDlqDeclare)
{
+ doSetProperty("skipDlqDeclare", skipDlqDeclare);
+ return this;
+ }
+ /**
+ * If true the producer will not declare and bind a dead letter queue.
+ * This can be used if you have also DLQ rabbitmq consumer and you want
+ * to avoid argument clashing between Producer and Consumer. This
option
+ * have no effect, if DLQ configured (deadLetterExchange option is not
+ * set).
+ *
+ * The option will be converted to a <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: common
+ */
+ default RabbitMQEndpointBuilder skipDlqDeclare(String skipDlqDeclare) {
+ doSetProperty("skipDlqDeclare", skipDlqDeclare);
+ return this;
+ }
+ /**
* This can be used if we need to declare the queue but not the
* exchange.
*
@@ -3111,8 +3215,9 @@ public interface RabbitMQEndpointBuilderFactory {
/**
* 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:
+ * arg.queue. Binding: arg.binding. DLQ: arg.dlq.queue. DLQ binding:
+ * arg.dlq.binding. For example to declare a queue with message ttl
+ * argument:
*
http://localhost:5672/exchange/queueargs=arg.queue.x-message-ttl=60000.
*
* The option is a: <code>java.util.Map<java.lang.String,
@@ -3130,8 +3235,9 @@ public interface RabbitMQEndpointBuilderFactory {
/**
* 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:
+ * arg.queue. Binding: arg.binding. DLQ: arg.dlq.queue. DLQ binding:
+ * arg.dlq.binding. For example to declare a queue with message ttl
+ * argument:
*
http://localhost:5672/exchange/queueargs=arg.queue.x-message-ttl=60000.
*
* The option is a: <code>java.util.Map<java.lang.String,
diff --git a/docs/components/modules/ROOT/pages/rabbitmq-component.adoc
b/docs/components/modules/ROOT/pages/rabbitmq-component.adoc
index 3e15cf4..ccf4fa5 100644
--- a/docs/components/modules/ROOT/pages/rabbitmq-component.adoc
+++ b/docs/components/modules/ROOT/pages/rabbitmq-component.adoc
@@ -99,7 +99,7 @@ The RabbitMQ component supports 53 options, which are listed
below.
| *mandatory* (producer) | This flag tells the server how to react if the
message cannot be routed to a queue. If this flag is set, the server will
return an unroutable message with a Return method. If this flag is zero, the
server silently drops the message. If the header is present rabbitmq.MANDATORY
it will override this option. | false | boolean
| *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
+| *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. DLQ: arg.dlq.queue. DLQ Binding:
arg.dlq.binding. For example to declare a queue with message ttl argument:
\http://localhost:5672/exchange/queueargs=arg.queue.x-message-ttl=60000 | | Map
| *autoDetectConnectionFactory* (advanced) | Whether to auto-detect looking up
RabbitMQ connection factory from the registry. When enabled and a single
instance of the connection factory is found then it will be used. An explicit
connection factory can be configured on the component or endpoint level which
takes precedence. | true | boolean
| *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
@@ -141,7 +141,7 @@ with the following path and query parameters:
|===
-=== Query Parameters (63 parameters):
+=== Query Parameters (64 parameters):
[width="100%",cols="2,5,^1,2",options="header"]
@@ -164,6 +164,7 @@ with the following path and query parameters:
| *portNumber* (common) | Port number for the host with the running rabbitmq
instance or cluster. Default value is 5672. | | int
| *queue* (common) | The queue to receive messages from | | String
| *routingKey* (common) | The routing key to use when binding a consumer queue
to the exchange. For producer routing keys, you set the header
rabbitmq.ROUTING_KEY. | | String
+| *skipDlqDeclare* (common) | If true the producer will not declare and bind a
dead letter queue. This can be used if you have also DLQ rabbitmq consumer and
you want to avoid argument clashing between Producer and Consumer. This option
have no effect, if DLQ configured (deadLetterExchange option is not set). |
false | boolean
| *skipExchangeDeclare* (common) | This can be used if we need to declare the
queue but not the exchange | false | boolean
| *skipQueueBind* (common) | If true the queue will not be bound to the
exchange after declaring it | false | boolean
| *skipQueueDeclare* (common) | If true the producer will not declare and bind
a queue. This can be used for directing messages via an existing routing key. |
false | boolean
@@ -191,7 +192,7 @@ with the following path and query parameters:
| *mandatory* (producer) | This flag tells the server how to react if the
message cannot be routed to a queue. If this flag is set, the server will
return an unroutable message with a Return method. If this flag is zero, the
server silently drops the message. If the header is present rabbitmq.MANDATORY
it will override this option. | false | boolean
| *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
+| *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. DLQ: arg.dlq.queue. DLQ binding:
arg.dlq.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