You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "sdurrenmatt (via GitHub)" <gi...@apache.org> on 2023/06/10 17:37:42 UTC

[GitHub] [camel] sdurrenmatt opened a new pull request, #10325: CAMEL-19417: camel-spring-rabbitmq - convert all message properties by default

sdurrenmatt opened a new pull request, #10325:
URL: https://github.com/apache/camel/pull/10325

   # Description
   
   The goal is to support all the most important RabbitMQ message properties by default (without the need to provide a custom ``MessagePropertiesConverter``). Those include the removed RabbitMQ component's message properties. Can simplify migration of applications from RabbitMQ to Spring RabbitMQ, which is a necessary step for migrating to Camel 4.
   
   I had to modify how content type and timestamp were already handled. I found it better to use new Spring RabbitMQ constants rather than exchange constants. This is a more consistent approach imo. Both are optional and application-specific, like most of the other message properties.
   
   This PR also includes a copy-paste bug fix in the method ``appendInputHeader``.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (note that Camel 3 uses `camel-3.x`, whereas Camel 4 uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it).
   
   <!--
   # *Note*: trivial changes like, typos, minor documentation fixes and other small items do not require a JIRA issue. In this case your pull request should address just this issue, without pulling in other changes.
   -->
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful subject line and body.
   
   <!--  
   If you're unsure, you can format the pull request title like `[CAMEL-XXX] Fixes bug in camel-file component`, where you replace `CAMEL-XXX` with the appropriate JIRA issue.
   -->
   
   - [x] I formatted the code using `mvn -Pformat,fastinstall install && mvn -Psourcecheck`
   
   <!-- 
   You can run the aforementioned command in your module so that the build auto-formats your code and the source check verifies that is complies with our coding style. This will also be verified as part of the checks and your PR may be rejected if the checkstyle does not pass.
   
   You can learn more about the contribution guidelines at https://github.com/apache/camel/blob/main/CONTRIBUTING.md
   -->
   
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #10325: CAMEL-19417: camel-spring-rabbitmq - convert all message properties by default

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #10325:
URL: https://github.com/apache/camel/pull/10325#issuecomment-1585792664

   ### Components test results:
   
   | Total | Tested | Failed :x: | Passed :white_check_mark: | 
   | --- | --- | --- |  --- |
   | 1 | 1 | 1 | 0 |


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] sdurrenmatt commented on a diff in pull request #10325: CAMEL-19417: camel-spring-rabbitmq - convert all message properties by default

Posted by "sdurrenmatt (via GitHub)" <gi...@apache.org>.
sdurrenmatt commented on code in PR #10325:
URL: https://github.com/apache/camel/pull/10325#discussion_r1225504047


##########
components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/DefaultMessagePropertiesConverter.java:
##########
@@ -39,9 +40,64 @@ public DefaultMessagePropertiesConverter(CamelContext camelContext, HeaderFilter
     @Override
     public MessageProperties toMessageProperties(Exchange exchange) {
         MessageProperties answer = new MessageProperties();
-        String contentType = ExchangeHelper.getContentType(exchange);
+
+        Object deliveryMode = exchange.getMessage().removeHeader(SpringRabbitMQConstants.DELIVERY_MODE);
+        if (deliveryMode != null) {
+            answer.setDeliveryMode(deliveryMode instanceof MessageDeliveryMode ? (MessageDeliveryMode) deliveryMode
+                    : MessageDeliveryMode.fromInt(Integer.parseInt(deliveryMode.toString())));
+        }
+        Object type = exchange.getMessage().removeHeader(SpringRabbitMQConstants.TYPE);

Review Comment:
   on second thought maybe this is something that header filter strategy should take care of? we may want to re-use a header or two after the message has been published.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] essobedo commented on a diff in pull request #10325: CAMEL-19417: camel-spring-rabbitmq - convert all message properties by default

Posted by "essobedo (via GitHub)" <gi...@apache.org>.
essobedo commented on code in PR #10325:
URL: https://github.com/apache/camel/pull/10325#discussion_r1225494410


##########
components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/SpringRabbitMQConstants.java:
##########
@@ -23,12 +23,47 @@ public final class SpringRabbitMQConstants {
     public static final String DEFAULT_EXCHANGE_NAME = "default";
 
     public static final String CHANNEL = "CamelSpringRabbitmqChannel";
-    @Metadata(description = "The exchange key.", javaType = "String")
+    @Metadata(description = "Producer: To override the endpoint configuration's routing key.", javaType = "String")

Review Comment:
   ditto with "producer"



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] essobedo commented on a diff in pull request #10325: CAMEL-19417: camel-spring-rabbitmq - convert all message properties by default

Posted by "essobedo (via GitHub)" <gi...@apache.org>.
essobedo commented on code in PR #10325:
URL: https://github.com/apache/camel/pull/10325#discussion_r1225510027


##########
components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/DefaultMessagePropertiesConverter.java:
##########
@@ -39,12 +41,68 @@ public DefaultMessagePropertiesConverter(CamelContext camelContext, HeaderFilter
     @Override
     public MessageProperties toMessageProperties(Exchange exchange) {
         MessageProperties answer = new MessageProperties();
-        String contentType = ExchangeHelper.getContentType(exchange);
+        Message message = exchange.getMessage();
+
+        Object deliveryMode = message.getHeader(SpringRabbitMQConstants.DELIVERY_MODE);
+        if (deliveryMode != null) {
+            answer.setDeliveryMode(deliveryMode instanceof MessageDeliveryMode ? (MessageDeliveryMode) deliveryMode
+                    : MessageDeliveryMode.fromInt(Integer.parseInt(deliveryMode.toString())));
+        }
+        Object type = message.getHeader(SpringRabbitMQConstants.TYPE);
+        if (type != null) {
+            answer.setType(type.toString());

Review Comment:
   Same here, why don't you use the method `getHeader(String name, Class<T> type)` to trigger the type conversion if needed?



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #10325: CAMEL-19417: camel-spring-rabbitmq - convert all message properties by default

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #10325:
URL: https://github.com/apache/camel/pull/10325#issuecomment-1586070869

   :no_entry_sign: There are (likely) no changes in core core to be tested in this PR


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] essobedo commented on a diff in pull request #10325: CAMEL-19417: camel-spring-rabbitmq - convert all message properties by default

Posted by "essobedo (via GitHub)" <gi...@apache.org>.
essobedo commented on code in PR #10325:
URL: https://github.com/apache/camel/pull/10325#discussion_r1225492673


##########
components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/DefaultMessagePropertiesConverter.java:
##########
@@ -39,9 +40,64 @@ public DefaultMessagePropertiesConverter(CamelContext camelContext, HeaderFilter
     @Override
     public MessageProperties toMessageProperties(Exchange exchange) {
         MessageProperties answer = new MessageProperties();
-        String contentType = ExchangeHelper.getContentType(exchange);
+
+        Object deliveryMode = exchange.getMessage().removeHeader(SpringRabbitMQConstants.DELIVERY_MODE);
+        if (deliveryMode != null) {
+            answer.setDeliveryMode(deliveryMode instanceof MessageDeliveryMode ? (MessageDeliveryMode) deliveryMode
+                    : MessageDeliveryMode.fromInt(Integer.parseInt(deliveryMode.toString())));
+        }
+        Object type = exchange.getMessage().removeHeader(SpringRabbitMQConstants.TYPE);

Review Comment:
   Is-it necessary to remove the header?



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #10325: CAMEL-19417: camel-spring-rabbitmq - convert all message properties by default

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #10325:
URL: https://github.com/apache/camel/pull/10325#issuecomment-1585748639

   :star2: Thank you for your contribution to the Apache Camel project! :star2: 
   
   :camel: Maintainers, please note that first-time contributors *require manual approval* for the GitHub Actions to run.
   
   :warning: Please note that the changes on this PR may be **tested automatically** if they change components.
   
   :robot: Use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot.
   
   If necessary Apache Camel Committers may access logs and test results in the job summaries!


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] davsclaus merged pull request #10325: CAMEL-19417: camel-spring-rabbitmq - convert all message properties by default

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus merged PR #10325:
URL: https://github.com/apache/camel/pull/10325


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] essobedo commented on a diff in pull request #10325: CAMEL-19417: camel-spring-rabbitmq - convert all message properties by default

Posted by "essobedo (via GitHub)" <gi...@apache.org>.
essobedo commented on code in PR #10325:
URL: https://github.com/apache/camel/pull/10325#discussion_r1225494188


##########
components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/SpringRabbitMQConstants.java:
##########
@@ -23,12 +23,47 @@ public final class SpringRabbitMQConstants {
     public static final String DEFAULT_EXCHANGE_NAME = "default";
 
     public static final String CHANNEL = "CamelSpringRabbitmqChannel";
-    @Metadata(description = "The exchange key.", javaType = "String")
+    @Metadata(description = "Producer: To override the endpoint configuration's routing key.", javaType = "String")
     public static final String ROUTING_OVERRIDE_KEY = "CamelSpringRabbitmqRoutingOverrideKey";
-    @Metadata(description = "The exchange name.", javaType = "String")
+    @Metadata(description = "Producer: To override the endpoint configuration's exchange name.", javaType = "String")
     public static final String EXCHANGE_OVERRIDE_NAME = "CamelSpringRabbitmqExchangeOverrideName";
-    @Metadata(description = "Delivery tag for manual acknowledge mode", javaType = "long")
+    @Metadata(description = "Consumer: Whether the message was previously delivered and requeued.", javaType = "Boolean")

Review Comment:
   If it is only meant for the consumer, you could rather set the label to "consumer"



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] sdurrenmatt commented on a diff in pull request #10325: CAMEL-19417: camel-spring-rabbitmq - convert all message properties by default

Posted by "sdurrenmatt (via GitHub)" <gi...@apache.org>.
sdurrenmatt commented on code in PR #10325:
URL: https://github.com/apache/camel/pull/10325#discussion_r1225493146


##########
components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/DefaultMessagePropertiesConverter.java:
##########
@@ -39,9 +40,64 @@ public DefaultMessagePropertiesConverter(CamelContext camelContext, HeaderFilter
     @Override
     public MessageProperties toMessageProperties(Exchange exchange) {
         MessageProperties answer = new MessageProperties();
-        String contentType = ExchangeHelper.getContentType(exchange);
+
+        Object deliveryMode = exchange.getMessage().removeHeader(SpringRabbitMQConstants.DELIVERY_MODE);
+        if (deliveryMode != null) {
+            answer.setDeliveryMode(deliveryMode instanceof MessageDeliveryMode ? (MessageDeliveryMode) deliveryMode
+                    : MessageDeliveryMode.fromInt(Integer.parseInt(deliveryMode.toString())));
+        }
+        Object type = exchange.getMessage().removeHeader(SpringRabbitMQConstants.TYPE);

Review Comment:
   Yes we do not want it to be copied later on to the RabbitMQ message.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] sdurrenmatt commented on a diff in pull request #10325: CAMEL-19417: camel-spring-rabbitmq - convert all message properties by default

Posted by "sdurrenmatt (via GitHub)" <gi...@apache.org>.
sdurrenmatt commented on code in PR #10325:
URL: https://github.com/apache/camel/pull/10325#discussion_r1225526516


##########
components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/DefaultMessagePropertiesConverter.java:
##########
@@ -39,12 +41,68 @@ public DefaultMessagePropertiesConverter(CamelContext camelContext, HeaderFilter
     @Override
     public MessageProperties toMessageProperties(Exchange exchange) {
         MessageProperties answer = new MessageProperties();
-        String contentType = ExchangeHelper.getContentType(exchange);
+        Message message = exchange.getMessage();
+
+        Object deliveryMode = message.getHeader(SpringRabbitMQConstants.DELIVERY_MODE);
+        if (deliveryMode != null) {
+            answer.setDeliveryMode(deliveryMode instanceof MessageDeliveryMode ? (MessageDeliveryMode) deliveryMode
+                    : MessageDeliveryMode.fromInt(Integer.parseInt(deliveryMode.toString())));
+        }
+        Object type = message.getHeader(SpringRabbitMQConstants.TYPE);
+        if (type != null) {
+            answer.setType(type.toString());

Review Comment:
   done everywhere



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] sdurrenmatt commented on a diff in pull request #10325: CAMEL-19417: camel-spring-rabbitmq - convert all message properties by default

Posted by "sdurrenmatt (via GitHub)" <gi...@apache.org>.
sdurrenmatt commented on code in PR #10325:
URL: https://github.com/apache/camel/pull/10325#discussion_r1225497790


##########
components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/DefaultMessagePropertiesConverter.java:
##########
@@ -39,9 +40,64 @@ public DefaultMessagePropertiesConverter(CamelContext camelContext, HeaderFilter
     @Override
     public MessageProperties toMessageProperties(Exchange exchange) {
         MessageProperties answer = new MessageProperties();
-        String contentType = ExchangeHelper.getContentType(exchange);
+
+        Object deliveryMode = exchange.getMessage().removeHeader(SpringRabbitMQConstants.DELIVERY_MODE);

Review Comment:
   done



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] essobedo commented on a diff in pull request #10325: CAMEL-19417: camel-spring-rabbitmq - convert all message properties by default

Posted by "essobedo (via GitHub)" <gi...@apache.org>.
essobedo commented on code in PR #10325:
URL: https://github.com/apache/camel/pull/10325#discussion_r1225507881


##########
components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/DefaultMessagePropertiesConverter.java:
##########
@@ -39,9 +40,64 @@ public DefaultMessagePropertiesConverter(CamelContext camelContext, HeaderFilter
     @Override
     public MessageProperties toMessageProperties(Exchange exchange) {
         MessageProperties answer = new MessageProperties();
-        String contentType = ExchangeHelper.getContentType(exchange);
+
+        Object deliveryMode = exchange.getMessage().removeHeader(SpringRabbitMQConstants.DELIVERY_MODE);
+        if (deliveryMode != null) {
+            answer.setDeliveryMode(deliveryMode instanceof MessageDeliveryMode ? (MessageDeliveryMode) deliveryMode
+                    : MessageDeliveryMode.fromInt(Integer.parseInt(deliveryMode.toString())));
+        }
+        Object type = exchange.getMessage().removeHeader(SpringRabbitMQConstants.TYPE);

Review Comment:
   What I can tell for sure is that it is quite unexpected that a converter alters the message. If they need to be removed it should be definitively done elsewhere IMHO



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] sdurrenmatt commented on a diff in pull request #10325: CAMEL-19417: camel-spring-rabbitmq - convert all message properties by default

Posted by "sdurrenmatt (via GitHub)" <gi...@apache.org>.
sdurrenmatt commented on code in PR #10325:
URL: https://github.com/apache/camel/pull/10325#discussion_r1225526228


##########
components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/DefaultMessagePropertiesConverter.java:
##########
@@ -39,12 +41,68 @@ public DefaultMessagePropertiesConverter(CamelContext camelContext, HeaderFilter
     @Override
     public MessageProperties toMessageProperties(Exchange exchange) {
         MessageProperties answer = new MessageProperties();
-        String contentType = ExchangeHelper.getContentType(exchange);
+        Message message = exchange.getMessage();
+
+        Object deliveryMode = message.getHeader(SpringRabbitMQConstants.DELIVERY_MODE);
+        if (deliveryMode != null) {
+            answer.setDeliveryMode(deliveryMode instanceof MessageDeliveryMode ? (MessageDeliveryMode) deliveryMode
+                    : MessageDeliveryMode.fromInt(Integer.parseInt(deliveryMode.toString())));

Review Comment:
   right this is ambiguous especially since this is an enum... I simplified that and added the enums for the doc.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] essobedo commented on a diff in pull request #10325: CAMEL-19417: camel-spring-rabbitmq - convert all message properties by default

Posted by "essobedo (via GitHub)" <gi...@apache.org>.
essobedo commented on code in PR #10325:
URL: https://github.com/apache/camel/pull/10325#discussion_r1225495475


##########
components/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerIT.java:
##########
@@ -118,15 +120,26 @@ public void testProducerContentType() throws Exception {
         admin.declareExchange(t);
         admin.declareBinding(BindingBuilder.bind(q).to(t).with("foo.bar.#"));
 
-        template.sendBodyAndHeader("direct:start", "<price>123</price>", Exchange.CONTENT_TYPE, "application/xml");
+        template.sendBodyAndHeaders("direct:start", "<price>123</price>",
+                ImmutableMap.<String, Object>builder()

Review Comment:
   Let's use `Map.of` instead



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #10325: CAMEL-19417: camel-spring-rabbitmq - convert all message properties by default

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #10325:
URL: https://github.com/apache/camel/pull/10325#issuecomment-1586070866

   ### Components test results:
   
   | Total | Tested | Failed :x: | Passed :white_check_mark: | 
   | --- | --- | --- |  --- |
   | 1 | 1 | 0 | 1 |


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] sdurrenmatt commented on a diff in pull request #10325: CAMEL-19417: camel-spring-rabbitmq - convert all message properties by default

Posted by "sdurrenmatt (via GitHub)" <gi...@apache.org>.
sdurrenmatt commented on code in PR #10325:
URL: https://github.com/apache/camel/pull/10325#discussion_r1225497664


##########
components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/SpringRabbitMQConstants.java:
##########
@@ -23,12 +23,47 @@ public final class SpringRabbitMQConstants {
     public static final String DEFAULT_EXCHANGE_NAME = "default";
 
     public static final String CHANNEL = "CamelSpringRabbitmqChannel";
-    @Metadata(description = "The exchange key.", javaType = "String")
+    @Metadata(description = "Producer: To override the endpoint configuration's routing key.", javaType = "String")
     public static final String ROUTING_OVERRIDE_KEY = "CamelSpringRabbitmqRoutingOverrideKey";
-    @Metadata(description = "The exchange name.", javaType = "String")
+    @Metadata(description = "Producer: To override the endpoint configuration's exchange name.", javaType = "String")
     public static final String EXCHANGE_OVERRIDE_NAME = "CamelSpringRabbitmqExchangeOverrideName";
-    @Metadata(description = "Delivery tag for manual acknowledge mode", javaType = "long")
+    @Metadata(description = "Consumer: Whether the message was previously delivered and requeued.", javaType = "Boolean")

Review Comment:
   done



##########
components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/SpringRabbitMQConstants.java:
##########
@@ -23,12 +23,47 @@ public final class SpringRabbitMQConstants {
     public static final String DEFAULT_EXCHANGE_NAME = "default";
 
     public static final String CHANNEL = "CamelSpringRabbitmqChannel";
-    @Metadata(description = "The exchange key.", javaType = "String")
+    @Metadata(description = "Producer: To override the endpoint configuration's routing key.", javaType = "String")

Review Comment:
   done



##########
components/camel-spring-rabbitmq/src/test/java/org/apache/camel/component/springrabbit/integration/RabbitMQProducerIT.java:
##########
@@ -118,15 +120,26 @@ public void testProducerContentType() throws Exception {
         admin.declareExchange(t);
         admin.declareBinding(BindingBuilder.bind(q).to(t).with("foo.bar.#"));
 
-        template.sendBodyAndHeader("direct:start", "<price>123</price>", Exchange.CONTENT_TYPE, "application/xml");
+        template.sendBodyAndHeaders("direct:start", "<price>123</price>",
+                ImmutableMap.<String, Object>builder()

Review Comment:
   done



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] essobedo commented on a diff in pull request #10325: CAMEL-19417: camel-spring-rabbitmq - convert all message properties by default

Posted by "essobedo (via GitHub)" <gi...@apache.org>.
essobedo commented on code in PR #10325:
URL: https://github.com/apache/camel/pull/10325#discussion_r1225492483


##########
components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/DefaultMessagePropertiesConverter.java:
##########
@@ -39,9 +40,64 @@ public DefaultMessagePropertiesConverter(CamelContext camelContext, HeaderFilter
     @Override
     public MessageProperties toMessageProperties(Exchange exchange) {
         MessageProperties answer = new MessageProperties();
-        String contentType = ExchangeHelper.getContentType(exchange);
+
+        Object deliveryMode = exchange.getMessage().removeHeader(SpringRabbitMQConstants.DELIVERY_MODE);

Review Comment:
   Let's put `exchange.getMessage()` in a local variable instead of calling it several times



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] essobedo commented on a diff in pull request #10325: CAMEL-19417: camel-spring-rabbitmq - convert all message properties by default

Posted by "essobedo (via GitHub)" <gi...@apache.org>.
essobedo commented on code in PR #10325:
URL: https://github.com/apache/camel/pull/10325#discussion_r1225510027


##########
components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/DefaultMessagePropertiesConverter.java:
##########
@@ -39,12 +41,68 @@ public DefaultMessagePropertiesConverter(CamelContext camelContext, HeaderFilter
     @Override
     public MessageProperties toMessageProperties(Exchange exchange) {
         MessageProperties answer = new MessageProperties();
-        String contentType = ExchangeHelper.getContentType(exchange);
+        Message message = exchange.getMessage();
+
+        Object deliveryMode = message.getHeader(SpringRabbitMQConstants.DELIVERY_MODE);
+        if (deliveryMode != null) {
+            answer.setDeliveryMode(deliveryMode instanceof MessageDeliveryMode ? (MessageDeliveryMode) deliveryMode
+                    : MessageDeliveryMode.fromInt(Integer.parseInt(deliveryMode.toString())));
+        }
+        Object type = message.getHeader(SpringRabbitMQConstants.TYPE);
+        if (type != null) {
+            answer.setType(type.toString());

Review Comment:
   Same here, why don't you use the method `getHeader(SpringRabbitMQConstants.TYPE, String.class)` to trigger the type conversion if needed?



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] sdurrenmatt commented on a diff in pull request #10325: CAMEL-19417: camel-spring-rabbitmq - convert all message properties by default

Posted by "sdurrenmatt (via GitHub)" <gi...@apache.org>.
sdurrenmatt commented on code in PR #10325:
URL: https://github.com/apache/camel/pull/10325#discussion_r1225526228


##########
components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/DefaultMessagePropertiesConverter.java:
##########
@@ -39,12 +41,68 @@ public DefaultMessagePropertiesConverter(CamelContext camelContext, HeaderFilter
     @Override
     public MessageProperties toMessageProperties(Exchange exchange) {
         MessageProperties answer = new MessageProperties();
-        String contentType = ExchangeHelper.getContentType(exchange);
+        Message message = exchange.getMessage();
+
+        Object deliveryMode = message.getHeader(SpringRabbitMQConstants.DELIVERY_MODE);
+        if (deliveryMode != null) {
+            answer.setDeliveryMode(deliveryMode instanceof MessageDeliveryMode ? (MessageDeliveryMode) deliveryMode
+                    : MessageDeliveryMode.fromInt(Integer.parseInt(deliveryMode.toString())));

Review Comment:
   right this is ambiguous especially since this is an enum... I simplifed that and added the enums for the doc.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] github-actions[bot] commented on pull request #10325: CAMEL-19417: camel-spring-rabbitmq - convert all message properties by default

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #10325:
URL: https://github.com/apache/camel/pull/10325#issuecomment-1585792669

   :no_entry_sign: There are (likely) no changes in core core to be tested in this PR


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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


[GitHub] [camel] essobedo commented on a diff in pull request #10325: CAMEL-19417: camel-spring-rabbitmq - convert all message properties by default

Posted by "essobedo (via GitHub)" <gi...@apache.org>.
essobedo commented on code in PR #10325:
URL: https://github.com/apache/camel/pull/10325#discussion_r1225509686


##########
components/camel-spring-rabbitmq/src/main/java/org/apache/camel/component/springrabbit/DefaultMessagePropertiesConverter.java:
##########
@@ -39,12 +41,68 @@ public DefaultMessagePropertiesConverter(CamelContext camelContext, HeaderFilter
     @Override
     public MessageProperties toMessageProperties(Exchange exchange) {
         MessageProperties answer = new MessageProperties();
-        String contentType = ExchangeHelper.getContentType(exchange);
+        Message message = exchange.getMessage();
+
+        Object deliveryMode = message.getHeader(SpringRabbitMQConstants.DELIVERY_MODE);
+        if (deliveryMode != null) {
+            answer.setDeliveryMode(deliveryMode instanceof MessageDeliveryMode ? (MessageDeliveryMode) deliveryMode
+                    : MessageDeliveryMode.fromInt(Integer.parseInt(deliveryMode.toString())));

Review Comment:
   Let's see what others say but I'm not really a fan of calling `toString` without even knowing/checking the type 



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

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