You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2020/09/17 11:17:48 UTC

[GitHub] [camel] rgannu commented on a change in pull request #4241: CAMEL-15496: Add support for additional headers and properties

rgannu commented on a change in pull request #4241:
URL: https://github.com/apache/camel/pull/4241#discussion_r490163365



##########
File path: components/camel-rabbitmq/src/main/java/org/apache/camel/component/rabbitmq/RabbitMQConstants.java
##########
@@ -16,42 +16,76 @@
  */
 package org.apache.camel.component.rabbitmq;
 
-public final class RabbitMQConstants {
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+public enum RabbitMQConstants {
 
     // TODO need to change the constant which is start with camel
-    public static final String ROUTING_KEY = "rabbitmq.ROUTING_KEY";
-    public static final String EXCHANGE_OVERRIDE_NAME = "rabbitmq.EXCHANGE_OVERRIDE_NAME";
-    public static final String EXCHANGE_NAME = "rabbitmq.EXCHANGE_NAME";
-    public static final String CONTENT_TYPE = "rabbitmq.CONTENT_TYPE";
-    public static final String PRIORITY = "rabbitmq.PRIORITY";
-    public static final String DELIVERY_TAG = "rabbitmq.DELIVERY_TAG";
-    public static final String REDELIVERY_TAG = "rabbitmq.REDELIVERY_TAG";
-    public static final String CORRELATIONID = "rabbitmq.CORRELATIONID";
-    public static final String MESSAGE_ID = "rabbitmq.MESSAGE_ID";
-    public static final String DELIVERY_MODE = "rabbitmq.DELIVERY_MODE";
-    public static final String USERID = "rabbitmq.USERID";
-    public static final String CLUSTERID = "rabbitmq.CLUSTERID";
-    public static final String REQUEST_TIMEOUT = "rabbitmq.REQUEST_TIMEOUT";
-    public static final String REPLY_TO = "rabbitmq.REPLY_TO";
-    public static final String CONTENT_ENCODING = "rabbitmq.CONTENT_ENCODING";
-    public static final String TYPE = "rabbitmq.TYPE";
-    public static final String EXPIRATION = "rabbitmq.EXPIRATION";
-    public static final String TIMESTAMP = "rabbitmq.TIMESTAMP";
-    public static final String APP_ID = "rabbitmq.APP_ID";
-    public static final String REQUEUE = "rabbitmq.REQUEUE";
-    public static final String MANDATORY = "rabbitmq.MANDATORY";
-    public static final String IMMEDIATE = "rabbitmq.IMMEDIATE";
-    public static final String RABBITMQ_DEAD_LETTER_EXCHANGE = "x-dead-letter-exchange";
-    public static final String RABBITMQ_DEAD_LETTER_ROUTING_KEY = "x-dead-letter-routing-key";
-    public static final String RABBITMQ_DIRECT_REPLY_EXCHANGE = "";
-    public static final String RABBITMQ_DIRECT_REPLY_ROUTING_KEY = "amq.rabbitmq.reply-to";
-    public static final String RABBITMQ_QUEUE_LENGTH_LIMIT_KEY = "x-max-length";
-    public static final String RABBITMQ_QUEUE_MAX_PRIORITY_KEY = "x-max-priority";
-    public static final String RABBITMQ_QUEUE_MESSAGE_TTL_KEY = "x-message-ttl";
-    public static final String RABBITMQ_QUEUE_TTL_KEY = "x-expires";
-    public static final String RABBITMQ_QUEUE_SINGLE_ACTIVE_CONSUMER_KEY = "x-single-active-consumer";
-
-    private RabbitMQConstants() {
-        // Constants class
+    ROUTING_KEY("rabbitmq-ROUTING_KEY", "The routing key that will be used when sending the message"),

Review comment:
       Header names are not changed.. I checked myself... 
   For my PR, I added support to add via the sink connector configuration way to add any Basic AMQP properties as 
   
    `    
   "camel.sink.endpoint.additionalProperties": "#bean:addProperties",
   
   "camel.beans.addProperties": "#class:org.apache.camel.support.beans.SimpleDataHolderBean",
   "camel.beans.addProperties.mapData[rabbitmq-CONTENT_TYPE]": "application/octet-stream",
   "camel.beans.addProperties.mapData[rabbitmq-CONTENT_ENCODING]": "binary",
   `
   When the property value is given as `mapData[rabbitmq.CONTENT_TYPE]`, due to the fix done as part of CAMEL-15394, 
   https://github.com/apache/camel/blob/master/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java#L408
   the property is split into parts and then we are trying to search for property value for `CONTENT_TYPE]` which will not be there. 
   
   I do not want to change this part and so I can in RabbitMQConstants.java
    - Remove the prefix `rabbitmq.` or
    - Change the prefix to `rabbitmq-` (which is what I have done)
   Both of these solution works, without changing the changes done for CAMEL-15394.
   
   Also the properties get set properly in the AMQP message as this is based on the com.rabbitmq.client.AMQP.BasicProperties in which we need to explicitly set the basic AMQP properties. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org