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 2022/02/22 09:41:32 UTC

[GitHub] [camel] zhfeng opened a new pull request #7014: CAMEL-17474: camel-jta - Mark exchange transacted in JtaTransacionErr…

zhfeng opened a new pull request #7014:
URL: https://github.com/apache/camel/pull/7014


   …orHandler
   
   My attempt to fix [CAMEL-17474](https://issues.apache.org/jira/browse/CAMEL-17474) and suppress https://github.com/apache/camel/pull/7004
   <!-- Uncomment and fill this section if your PR is not trivial
   - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it).  Trivial changes like typos do not require a JIRA issue.  Your pull request should address just this issue, without pulling in other changes.
   - [ ] Each commit in the pull request should have 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.
   - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [ ] Run `mvn clean install -Psourcecheck` in your module with source check enabled to make sure basic checks pass and there are no checkstyle violations. A more thorough check will be performed on your pull request automatically.
   Below are the contribution guidelines:
   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] zhfeng commented on pull request #7014: CAMEL-17474: camel-jta - Mark exchange transacted in JtaTransacionErr…

Posted by GitBox <gi...@apache.org>.
zhfeng commented on pull request #7014:
URL: https://github.com/apache/camel/pull/7014#issuecomment-1048604487


   Thanks @davsclaus  and I've done all the changes in your comments.


-- 
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 #7014: CAMEL-17474: camel-jta - Mark exchange transacted in JtaTransacionErr…

Posted by GitBox <gi...@apache.org>.
davsclaus merged pull request #7014:
URL: https://github.com/apache/camel/pull/7014


   


-- 
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 commented on a change in pull request #7014: CAMEL-17474: camel-jta - Mark exchange transacted in JtaTransacionErr…

Posted by GitBox <gi...@apache.org>.
davsclaus commented on a change in pull request #7014:
URL: https://github.com/apache/camel/pull/7014#discussion_r812625620



##########
File path: components/camel-jta/src/main/java/org/apache/camel/jta/JtaTransactionErrorHandler.java
##########
@@ -64,4 +69,16 @@ public ErrorHandler clone(Processor output) {
         return answer;
     }
 
+    @Override
+    public boolean process(final Exchange exchange, final AsyncCallback callback) {
+        if (!exchange.isTransacted()) {
+            LOG.debug("mark " + exchange + " transacted");
+            exchange.getUnitOfWork().beginTransactedBy("jta");
+            super.process(exchange, callback);
+            exchange.getUnitOfWork().endTransactedBy("jta");

Review comment:
       I think you need to have the endTransacted in a try .. finally block to ensure it will be ended

##########
File path: components/camel-jta/src/main/java/org/apache/camel/jta/JtaTransactionErrorHandler.java
##########
@@ -64,4 +69,16 @@ public ErrorHandler clone(Processor output) {
         return answer;
     }
 
+    @Override
+    public boolean process(final Exchange exchange, final AsyncCallback callback) {
+        if (!exchange.isTransacted()) {
+            LOG.debug("mark " + exchange + " transacted");
+            exchange.getUnitOfWork().beginTransactedBy("jta");

Review comment:
       Maybe use camel-jta instead of jta

##########
File path: components/camel-jta/src/main/java/org/apache/camel/jta/JtaTransactionErrorHandler.java
##########
@@ -64,4 +69,16 @@ public ErrorHandler clone(Processor output) {
         return answer;
     }
 
+    @Override
+    public boolean process(final Exchange exchange, final AsyncCallback callback) {
+        if (!exchange.isTransacted()) {
+            LOG.debug("mark " + exchange + " transacted");
+            exchange.getUnitOfWork().beginTransactedBy("jta");
+            super.process(exchange, callback);
+            exchange.getUnitOfWork().endTransactedBy("jta");
+        } else {
+            super.process(exchange, callback);
+        }
+        return false;

Review comment:
       This may be an existing "issue" as the returned value should be the output from super.process and not hardcoded to false

##########
File path: components/camel-jta/src/main/java/org/apache/camel/jta/JtaTransactionErrorHandler.java
##########
@@ -64,4 +69,16 @@ public ErrorHandler clone(Processor output) {
         return answer;
     }
 
+    @Override
+    public boolean process(final Exchange exchange, final AsyncCallback callback) {
+        if (!exchange.isTransacted()) {
+            LOG.debug("mark " + exchange + " transacted");

Review comment:
       Can you use logger placeholders: "Mark {} as transacted", exchange 




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