davsclaus commented on code in PR #13403:
URL: https://github.com/apache/camel/pull/13403#discussion_r1518811060


##########
components/camel-amqp/src/main/java/org/apache/camel/component/amqp/AMQPConfiguration.java:
##########
@@ -51,4 +64,28 @@ public void setIncludeAmqpAnnotations(boolean 
includeAmqpAnnotations) {
         this.includeAmqpAnnotations = includeAmqpAnnotations;
     }
 
+    public static class CamelAmqpTemplate extends CamelJmsTemplate {
+
+        public CamelAmqpTemplate(AMQPConfiguration config, ConnectionFactory 
connectionFactory) {
+            super(config, connectionFactory);
+        }
+
+        @Override
+        protected void commitIfNecessary(Session session) throws JMSException {
+            //# CAMEL-20521 - we can't use JmsUtils.commitIfNecessary because 
it catches
+            // jakarta.jms.IllegalStateException that can be thrown if the 
session is closed
+
+            // Check commit - avoid commit call within a JTA transaction.
+            if (session.getTransacted() && 
isSessionLocallyTransacted(session)) {
+                // Transacted session created by this template -> commit.
+                Assert.notNull(session, "Session must not be null");

Review Comment:
   This assert seems not to make sense as you will have NPE above



-- 
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-unsubscr...@camel.apache.org

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

Reply via email to