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 220390a  CAMEL-12330: Allow to configure more option on rabbitmq 
component level.
220390a is described below

commit 220390aff10be3f17d10414b769a3c59e7e82ad6
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Mar 10 10:09:11 2018 +0100

    CAMEL-12330: Allow to configure more option on rabbitmq component level.
---
 .../src/main/docs/rabbitmq-component.adoc          |  19 +-
 .../component/rabbitmq/RabbitMQComponent.java      | 192 ++++++++++++++++++++-
 .../camel/component/rabbitmq/RabbitMQEndpoint.java |   2 +-
 .../springboot/RabbitMQComponentConfiguration.java | 161 +++++++++++++++++
 4 files changed, 367 insertions(+), 7 deletions(-)

diff --git a/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc 
b/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc
index ff585ad..e5d405f 100644
--- a/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc
+++ b/components/camel-rabbitmq/src/main/docs/rabbitmq-component.adoc
@@ -47,7 +47,7 @@ exchange name determines which exchange the queue will bind 
to.
 === Options
 
 // component options: START
-The RabbitMQ component supports 35 options which are listed below.
+The RabbitMQ component supports 48 options which are listed below.
 
 
 
@@ -86,8 +86,21 @@ The RabbitMQ component supports 35 options which are listed 
below.
 | *immediate* (producer) | This flag tells the server how to react if the 
message cannot be routed to a queue consumer immediately. If this flag is set, 
the server will return an undeliverable message with a Return method. If this 
flag is zero, the server will queue the message, but with no guarantee that it 
will ever be consumed. If the header is present rabbitmq.IMMEDIATE it will 
override this option. | false | boolean
 | *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
 | *clientProperties* (advanced) | Connection client properties (client info 
used in negotiating with the server) |  | Map
-| *sslProtocol* (common) | Enables SSL on connection, accepted value are true, 
TLS and 'SSLv3 |  | String
-| *trustManager* (common) | Configure SSL trust manager, SSL should be enabled 
for this option to be effective |  | TrustManager
+| *sslProtocol* (security) | Enables SSL on connection, accepted value are 
true, TLS and 'SSLv3 |  | String
+| *trustManager* (security) | Configure SSL trust manager, SSL should be 
enabled for this option to be effective |  | TrustManager
+| *autoAck* (consumer) | If messages should be auto acknowledged | true | 
boolean
+| *autoDelete* (common) | If it is true, the exchange will be deleted when it 
is no longer in use | true | boolean
+| *durable* (common) | If we are declaring a durable exchange (the exchange 
will survive a server restart) | true | boolean
+| *exclusive* (common) | Exclusive queues may only be accessed by the current 
connection, and are deleted when that connection closes. | false | boolean
+| *passive* (common) | Passive queues depend on the queue already to be 
available at RabbitMQ. | 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
+| *skipQueueBind* (common) | If true the queue will not be bound to the 
exchange after declaring it | false | boolean
+| *skipExchangeDeclare* (common) | This can be used if we need to declare the 
queue but not the exchange | false | boolean
+| *declare* (common) | If the option is true, camel declare the exchange and 
queue name and bind them together. If the option is false, camel won't declare 
the exchange and queue name on the server. | true | boolean
+| *deadLetterExchange* (common) | The name of the dead letter exchange |  | 
String
+| *deadLetterQueue* (common) | The name of the dead letter queue |  | String
+| *deadLetterRoutingKey* (common) | The routing key for the dead letter 
exchange |  | String
+| *deadLetterExchangeType* (common) | The type of the dead letter exchange | 
direct | String
 | *resolveProperty Placeholders* (advanced) | Whether the component should 
resolve property placeholders on itself when starting. Only properties which 
are of String type can use property placeholders. | true | boolean
 |===
 // component options: END
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 05eb8d1..c258a5c 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
@@ -26,7 +26,6 @@ import com.rabbitmq.client.ConnectionFactory;
 import org.apache.camel.CamelContext;
 import org.apache.camel.impl.UriEndpointComponent;
 import org.apache.camel.spi.Metadata;
-import org.apache.camel.spi.UriParam;
 import org.apache.camel.util.IntrospectionSupport;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -54,9 +53,35 @@ public class RabbitMQComponent extends UriEndpointComponent {
     private Address[] addresses;
     @Metadata(label = "common")
     private ConnectionFactory connectionFactory;
-    @UriParam(label = "security")
+    @Metadata(label = "consumer", defaultValue = "true")
+    private boolean autoAck = true;
+    @Metadata(label = "common", defaultValue = "true")
+    private boolean autoDelete = true;
+    @Metadata(label = "common", defaultValue = "true")
+    private boolean durable = true;
+    @Metadata(label = "common")
+    private boolean exclusive;
+    @Metadata(label = "common")
+    private boolean passive;
+    @Metadata(label = "common", defaultValue = "true")
+    private boolean declare = true;
+    @Metadata(label = "common")
+    private boolean skipQueueDeclare;
+    @Metadata(label = "common")
+    private boolean skipQueueBind;
+    @Metadata(label = "common")
+    private boolean skipExchangeDeclare;
+    @Metadata(label = "common")
+    private String deadLetterExchange;
+    @Metadata(label = "common")
+    private String deadLetterRoutingKey;
+    @Metadata(label = "common")
+    private String deadLetterQueue;
+    @Metadata(label = "common", defaultValue = "direct", enums = 
"direct,fanout,headers,topic")
+    private String deadLetterExchangeType = "direct";
+    @Metadata(label = "security")
     private String sslProtocol;
-    @UriParam(label = "security")
+    @Metadata(label = "security")
     private TrustManager trustManager;
     @Metadata(label = "consumer,advanced", defaultValue = "10")
     private int threadPoolSize = 10;
@@ -200,6 +225,19 @@ public class RabbitMQComponent extends 
UriEndpointComponent {
         endpoint.setGuaranteedDeliveries(isGuaranteedDeliveries());
         endpoint.setMandatory(isMandatory());
         endpoint.setImmediate(isImmediate());
+        endpoint.setAutoAck(isAutoAck());
+        endpoint.setAutoDelete(isAutoDelete());
+        endpoint.setDurable(isDurable());
+        endpoint.setExclusive(isExclusive());
+        endpoint.setPassive(isPassive());
+        endpoint.setSkipExchangeDeclare(isSkipExchangeDeclare());
+        endpoint.setSkipQueueBind(isSkipQueueBind());
+        endpoint.setSkipQueueDeclare(isSkipQueueDeclare());
+        endpoint.setDeclare(isDeclare());
+        endpoint.setDeadLetterExchange(getDeadLetterExchange());
+        endpoint.setDeadLetterExchangeType(getDeadLetterExchangeType());
+        endpoint.setDeadLetterQueue(getDeadLetterQueue());
+        endpoint.setDeadLetterRoutingKey(getDeadLetterRoutingKey());
         setProperties(endpoint, params);
 
         if (LOG.isDebugEnabled()) {
@@ -658,4 +696,152 @@ public class RabbitMQComponent extends 
UriEndpointComponent {
         this.trustManager = trustManager;
     }
 
+    public boolean isAutoAck() {
+        return autoAck;
+    }
+
+    /**
+     * If messages should be auto acknowledged
+     */
+    public void setAutoAck(boolean autoAck) {
+        this.autoAck = autoAck;
+    }
+
+    public boolean isAutoDelete() {
+        return autoDelete;
+    }
+
+    /**
+     * If it is true, the exchange will be deleted when it is no longer in use
+     */
+    public void setAutoDelete(boolean autoDelete) {
+        this.autoDelete = autoDelete;
+    }
+
+    public boolean isDurable() {
+        return durable;
+    }
+
+    /**
+     * If we are declaring a durable exchange (the exchange will survive a
+     * server restart)
+     */
+    public void setDurable(boolean durable) {
+        this.durable = durable;
+    }
+
+    public boolean isExclusive() {
+        return exclusive;
+    }
+
+    /**
+     * Exclusive queues may only be accessed by the current connection, and are
+     * deleted when that connection closes.
+     */
+    public void setExclusive(boolean exclusive) {
+        this.exclusive = exclusive;
+    }
+
+    public boolean isPassive() {
+        return passive;
+    }
+
+    /**
+     * Passive queues depend on the queue already to be available at RabbitMQ.
+     */
+    public void setPassive(boolean passive) {
+        this.passive = passive;
+    }
+
+    /**
+     * If true the producer will not declare and bind a queue. This can be used
+     * for directing messages via an existing routing key.
+     */
+    public void setSkipQueueDeclare(boolean skipQueueDeclare) {
+        this.skipQueueDeclare = skipQueueDeclare;
+    }
+
+    public boolean isSkipQueueDeclare() {
+        return skipQueueDeclare;
+    }
+
+    /**
+     * If true the queue will not be bound to the exchange after declaring it
+     */
+    public boolean isSkipQueueBind() {
+        return skipQueueBind;
+    }
+
+    public void setSkipQueueBind(boolean skipQueueBind) {
+        this.skipQueueBind = skipQueueBind;
+    }
+
+    /**
+     * This can be used if we need to declare the queue but not the exchange
+     */
+    public void setSkipExchangeDeclare(boolean skipExchangeDeclare) {
+        this.skipExchangeDeclare = skipExchangeDeclare;
+    }
+
+    public boolean isSkipExchangeDeclare() {
+        return skipExchangeDeclare;
+    }
+
+    public boolean isDeclare() {
+        return declare;
+    }
+
+    /**
+     * If the option is true, camel declare the exchange and queue name and 
bind
+     * them together. If the option is false, camel won't declare the exchange
+     * and queue name on the server.
+     */
+    public void setDeclare(boolean declare) {
+        this.declare = declare;
+    }
+
+    public String getDeadLetterExchange() {
+        return deadLetterExchange;
+    }
+
+    /**
+     * The name of the dead letter exchange
+     */
+    public void setDeadLetterExchange(String deadLetterExchange) {
+        this.deadLetterExchange = deadLetterExchange;
+    }
+
+    public String getDeadLetterQueue() {
+        return deadLetterQueue;
+    }
+
+    /**
+     * The name of the dead letter queue
+     */
+    public void setDeadLetterQueue(String deadLetterQueue) {
+        this.deadLetterQueue = deadLetterQueue;
+    }
+
+    public String getDeadLetterRoutingKey() {
+        return deadLetterRoutingKey;
+    }
+
+    /**
+     * The routing key for the dead letter exchange
+     */
+    public void setDeadLetterRoutingKey(String deadLetterRoutingKey) {
+        this.deadLetterRoutingKey = deadLetterRoutingKey;
+    }
+
+    public String getDeadLetterExchangeType() {
+        return deadLetterExchangeType;
+    }
+
+    /**
+     * The type of the dead letter exchange
+     */
+    public void setDeadLetterExchangeType(String deadLetterExchangeType) {
+        this.deadLetterExchangeType = deadLetterExchangeType;
+    }
+
 }
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 86e60d5..39de2e3 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
@@ -126,7 +126,7 @@ public class RabbitMQEndpoint extends DefaultEndpoint 
implements AsyncEndpoint {
     private boolean prefetchGlobal;
     @UriParam(label = "consumer", defaultValue = "1")
     private int concurrentConsumers = 1;
-    @UriParam(defaultValue = "true")
+    @UriParam(label = "common", defaultValue = "true")
     private boolean declare = true;
     @UriParam(label = "common")
     private String deadLetterExchange;
diff --git 
a/platforms/spring-boot/components-starter/camel-rabbitmq-starter/src/main/java/org/apache/camel/component/rabbitmq/springboot/RabbitMQComponentConfiguration.java
 
b/platforms/spring-boot/components-starter/camel-rabbitmq-starter/src/main/java/org/apache/camel/component/rabbitmq/springboot/RabbitMQComponentConfiguration.java
index 69d8032..2288921 100644
--- 
a/platforms/spring-boot/components-starter/camel-rabbitmq-starter/src/main/java/org/apache/camel/component/rabbitmq/springboot/RabbitMQComponentConfiguration.java
+++ 
b/platforms/spring-boot/components-starter/camel-rabbitmq-starter/src/main/java/org/apache/camel/component/rabbitmq/springboot/RabbitMQComponentConfiguration.java
@@ -217,6 +217,63 @@ public class RabbitMQComponentConfiguration
      */
     private TrustManager trustManager;
     /**
+     * If messages should be auto acknowledged
+     */
+    private Boolean autoAck = true;
+    /**
+     * If it is true, the exchange will be deleted when it is no longer in use
+     */
+    private Boolean autoDelete = true;
+    /**
+     * If we are declaring a durable exchange (the exchange will survive a
+     * server restart)
+     */
+    private Boolean durable = true;
+    /**
+     * Exclusive queues may only be accessed by the current connection, and are
+     * deleted when that connection closes.
+     */
+    private Boolean exclusive = false;
+    /**
+     * Passive queues depend on the queue already to be available at RabbitMQ.
+     */
+    private Boolean passive = false;
+    /**
+     * If true the producer will not declare and bind a queue. This can be used
+     * for directing messages via an existing routing key.
+     */
+    private Boolean skipQueueDeclare = false;
+    /**
+     * If true the queue will not be bound to the exchange after declaring it
+     */
+    private Boolean skipQueueBind = false;
+    /**
+     * This can be used if we need to declare the queue but not the exchange
+     */
+    private Boolean skipExchangeDeclare = false;
+    /**
+     * If the option is true, camel declare the exchange and queue name and 
bind
+     * them together. If the option is false, camel won't declare the exchange
+     * and queue name on the server.
+     */
+    private Boolean declare = true;
+    /**
+     * The name of the dead letter exchange
+     */
+    private String deadLetterExchange;
+    /**
+     * The name of the dead letter queue
+     */
+    private String deadLetterQueue;
+    /**
+     * The routing key for the dead letter exchange
+     */
+    private String deadLetterRoutingKey;
+    /**
+     * The type of the dead letter exchange
+     */
+    private String deadLetterExchangeType = "direct";
+    /**
      * Whether the component should resolve property placeholders on itself 
when
      * starting. Only properties which are of String type can use property
      * placeholders.
@@ -498,6 +555,110 @@ public class RabbitMQComponentConfiguration
         this.trustManager = trustManager;
     }
 
+    public Boolean getAutoAck() {
+        return autoAck;
+    }
+
+    public void setAutoAck(Boolean autoAck) {
+        this.autoAck = autoAck;
+    }
+
+    public Boolean getAutoDelete() {
+        return autoDelete;
+    }
+
+    public void setAutoDelete(Boolean autoDelete) {
+        this.autoDelete = autoDelete;
+    }
+
+    public Boolean getDurable() {
+        return durable;
+    }
+
+    public void setDurable(Boolean durable) {
+        this.durable = durable;
+    }
+
+    public Boolean getExclusive() {
+        return exclusive;
+    }
+
+    public void setExclusive(Boolean exclusive) {
+        this.exclusive = exclusive;
+    }
+
+    public Boolean getPassive() {
+        return passive;
+    }
+
+    public void setPassive(Boolean passive) {
+        this.passive = passive;
+    }
+
+    public Boolean getSkipQueueDeclare() {
+        return skipQueueDeclare;
+    }
+
+    public void setSkipQueueDeclare(Boolean skipQueueDeclare) {
+        this.skipQueueDeclare = skipQueueDeclare;
+    }
+
+    public Boolean getSkipQueueBind() {
+        return skipQueueBind;
+    }
+
+    public void setSkipQueueBind(Boolean skipQueueBind) {
+        this.skipQueueBind = skipQueueBind;
+    }
+
+    public Boolean getSkipExchangeDeclare() {
+        return skipExchangeDeclare;
+    }
+
+    public void setSkipExchangeDeclare(Boolean skipExchangeDeclare) {
+        this.skipExchangeDeclare = skipExchangeDeclare;
+    }
+
+    public Boolean getDeclare() {
+        return declare;
+    }
+
+    public void setDeclare(Boolean declare) {
+        this.declare = declare;
+    }
+
+    public String getDeadLetterExchange() {
+        return deadLetterExchange;
+    }
+
+    public void setDeadLetterExchange(String deadLetterExchange) {
+        this.deadLetterExchange = deadLetterExchange;
+    }
+
+    public String getDeadLetterQueue() {
+        return deadLetterQueue;
+    }
+
+    public void setDeadLetterQueue(String deadLetterQueue) {
+        this.deadLetterQueue = deadLetterQueue;
+    }
+
+    public String getDeadLetterRoutingKey() {
+        return deadLetterRoutingKey;
+    }
+
+    public void setDeadLetterRoutingKey(String deadLetterRoutingKey) {
+        this.deadLetterRoutingKey = deadLetterRoutingKey;
+    }
+
+    public String getDeadLetterExchangeType() {
+        return deadLetterExchangeType;
+    }
+
+    public void setDeadLetterExchangeType(String deadLetterExchangeType) {
+        this.deadLetterExchangeType = deadLetterExchangeType;
+    }
+
     public Boolean getResolvePropertyPlaceholders() {
         return resolvePropertyPlaceholders;
     }

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to