You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Claus Ibsen (Created) (JIRA)" <ji...@apache.org> on 2011/11/11 13:46:51 UTC

[jira] [Created] (CAMEL-4668) JpaConsumer - Should rollback if processing of an exchange failed

JpaConsumer - Should rollback if processing of an exchange failed
-----------------------------------------------------------------

                 Key: CAMEL-4668
                 URL: https://issues.apache.org/jira/browse/CAMEL-4668
             Project: Camel
          Issue Type: Bug
          Components: camel-jpa
    Affects Versions: 2.8.2
            Reporter: Claus Ibsen
            Assignee: Claus Ibsen
             Fix For: 2.8.3, 2.9.0


If a JPA consumer pickup X messages and then one of those messages fails to be processed and throws an exception, then the JPA consumer should detect this and mark the TX as rollback.

Currently there is a flaw which causes the JPA consumer to commit the batch.

See nabble
http://camel.465427.n5.nabble.com/Misleading-jmx-statistics-on-jpa-component-tp4960503p4960503.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4668) JpaConsumer - Should rollback if processing of an exchange failed

Posted by "Preben Asmussen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13149055#comment-13149055 ] 

Preben Asmussen commented on CAMEL-4668:
----------------------------------------

@Claus

Regarding the jmx statistics I added this to your test:

        MBeanServer mBeanServer = context.getManagementStrategy().getManagementAgent().getMBeanServer();
        Set<ObjectName> objNameSet = mBeanServer.queryNames(new ObjectName("org.apache.camel:type=routes,name=\"foo\",*"), null);
        ObjectName managedObjName = new ArrayList<ObjectName>(objNameSet).get(0);
        Long exchangesCompleted = (Long) mBeanServer.invoke(managedObjName, "getExchangesCompleted", null, null);
        Long exchangesFailed = (Long) mBeanServer.invoke(managedObjName, "getExchangesFailed", null, null);
     
        assertTrue("Should be 0 since they are rolled back, was : " + exchangesCompleted, 0 == exchangesCompleted);
        assertTrue("Should be >=2, was: " + exchangesFailed , exchangesFailed >= 2);

Now the test fails since there are completed exchanges. Shouldn't the jmx statistics reflect that the exchange actual did not complete (rolled back) as the test implies ?


                
> JpaConsumer - Should rollback if processing of an exchange failed
> -----------------------------------------------------------------
>
>                 Key: CAMEL-4668
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4668
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jpa
>    Affects Versions: 2.7.4, 2.8.2
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.7.5, 2.8.3, 2.9.0
>
>
> If a JPA consumer pickup X messages and then one of those messages fails to be processed and throws an exception, then the JPA consumer should detect this and mark the TX as rollback.
> Currently there is a flaw which causes the JPA consumer to commit the batch.
> See nabble
> http://camel.465427.n5.nabble.com/Misleading-jmx-statistics-on-jpa-component-tp4960503p4960503.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CAMEL-4668) JpaConsumer - Should rollback if processing of an exchange failed

Posted by "Preben Asmussen (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4668?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Preben Asmussen updated CAMEL-4668:
-----------------------------------

    Attachment: JpaTXRollbackTest2.patch
    
> JpaConsumer - Should rollback if processing of an exchange failed
> -----------------------------------------------------------------
>
>                 Key: CAMEL-4668
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4668
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jpa
>    Affects Versions: 2.7.4, 2.8.2
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.7.5, 2.8.3, 2.9.0
>
>         Attachments: JpaTXRollbackTest.patch, JpaTXRollbackTest2.patch
>
>
> If a JPA consumer pickup X messages and then one of those messages fails to be processed and throws an exception, then the JPA consumer should detect this and mark the TX as rollback.
> Currently there is a flaw which causes the JPA consumer to commit the batch.
> See nabble
> http://camel.465427.n5.nabble.com/Misleading-jmx-statistics-on-jpa-component-tp4960503p4960503.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4668) JpaConsumer - Should rollback if processing of an exchange failed

Posted by "Babak Vahdat (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13149180#comment-13149180 ] 

Babak Vahdat commented on CAMEL-4668:
-------------------------------------

@Claus,

As Preben tries to push his JMX expectations I insist on my Routing expectations. Really not an easy job for you, but I really appreciate your contribution.

You said:

2: Then the route is started, which starts the consumer, it then pickup the 3 messages. And fail processing the last message. Which forces all 3 to rollback. So when it poll again, it find the 3 messages, and try again etc.

However a slight modification of this test case by me (see the attachment) proves the opposite, that is, after routing is completed there're *3* rows in the table! I've a suspection that somewhere along the way the thrown IllegalArgumentException("Forced") is simply swallowed!

Again my expectation is that the call to

{code}
template.sendBody("jpa://" + SendEmail.class.getName(), new SendEmail("kaboom@beer.org"));
{code}

Should blow up with a CamelExecutionException, but that's another story which I still don't understand :-(
                
> JpaConsumer - Should rollback if processing of an exchange failed
> -----------------------------------------------------------------
>
>                 Key: CAMEL-4668
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4668
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jpa
>    Affects Versions: 2.7.4, 2.8.2
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.7.5, 2.8.3, 2.9.0
>
>         Attachments: JpaTXRollbackTest.patch
>
>
> If a JPA consumer pickup X messages and then one of those messages fails to be processed and throws an exception, then the JPA consumer should detect this and mark the TX as rollback.
> Currently there is a flaw which causes the JPA consumer to commit the batch.
> See nabble
> http://camel.465427.n5.nabble.com/Misleading-jmx-statistics-on-jpa-component-tp4960503p4960503.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4668) JpaConsumer - Should rollback if processing of an exchange failed

Posted by "Babak Vahdat (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13149288#comment-13149288 ] 

Babak Vahdat commented on CAMEL-4668:
-------------------------------------

O.K. it took long for me to get the point but now I've got it! Sorry for my misapprehension. 
                
> JpaConsumer - Should rollback if processing of an exchange failed
> -----------------------------------------------------------------
>
>                 Key: CAMEL-4668
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4668
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jpa
>    Affects Versions: 2.7.4, 2.8.2
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.7.5, 2.8.3, 2.9.0
>
>         Attachments: JpaTXRollbackTest.patch, JpaTXRollbackTest2.patch
>
>
> If a JPA consumer pickup X messages and then one of those messages fails to be processed and throws an exception, then the JPA consumer should detect this and mark the TX as rollback.
> Currently there is a flaw which causes the JPA consumer to commit the batch.
> See nabble
> http://camel.465427.n5.nabble.com/Misleading-jmx-statistics-on-jpa-component-tp4960503p4960503.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4668) JpaConsumer - Should rollback if processing of an exchange failed

Posted by "Babak Vahdat (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13148497#comment-13148497 ] 

Babak Vahdat commented on CAMEL-4668:
-------------------------------------

There's something baffling me here, which I like to understand/learn how it's possible that it works!

Looking at [1] there's no try/catch or onException(....).handled(true) or the likes on the route, so sending the payload SendEmail("kaboom@beer.org") should blow up with a CamelExecutionException wrapping the thrown IllegalArgumentException("Forced") through the usage of the template on the client side (in this case the test method testTXRollback()) but it doesn't!!!

For sure I'm missing some pieces of this tricky puzzle...


[1] https://svn.apache.org/repos/asf/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaTXRollbackTest.java
                
> JpaConsumer - Should rollback if processing of an exchange failed
> -----------------------------------------------------------------
>
>                 Key: CAMEL-4668
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4668
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jpa
>    Affects Versions: 2.7.4, 2.8.2
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.7.5, 2.8.3, 2.9.0
>
>
> If a JPA consumer pickup X messages and then one of those messages fails to be processed and throws an exception, then the JPA consumer should detect this and mark the TX as rollback.
> Currently there is a flaw which causes the JPA consumer to commit the batch.
> See nabble
> http://camel.465427.n5.nabble.com/Misleading-jmx-statistics-on-jpa-component-tp4960503p4960503.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4668) JpaConsumer - Should rollback if processing of an exchange failed

Posted by "Claus Ibsen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13149027#comment-13149027 ] 

Claus Ibsen commented on CAMEL-4668:
------------------------------------

Sending to JPA does *not* fail. So the 3 template code lines works fine.

Its the Camel route that fails. The JPA consumer is scheduled, so it will poll again later (after 2sec). And it will keep failing due that hardcoded exception being thrown. But foo and bar records will be fine, but as they are part of the same TX, they will also rollback. So the foo and bar counter will keep incrementing.
                
> JpaConsumer - Should rollback if processing of an exchange failed
> -----------------------------------------------------------------
>
>                 Key: CAMEL-4668
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4668
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jpa
>    Affects Versions: 2.7.4, 2.8.2
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.7.5, 2.8.3, 2.9.0
>
>
> If a JPA consumer pickup X messages and then one of those messages fails to be processed and throws an exception, then the JPA consumer should detect this and mark the TX as rollback.
> Currently there is a flaw which causes the JPA consumer to commit the batch.
> See nabble
> http://camel.465427.n5.nabble.com/Misleading-jmx-statistics-on-jpa-component-tp4960503p4960503.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (CAMEL-4668) JpaConsumer - Should rollback if processing of an exchange failed

Posted by "Babak Vahdat (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13149281#comment-13149281 ] 

Babak Vahdat edited comment on CAMEL-4668 at 11/13/11 12:11 PM:
----------------------------------------------------------------

@Prebsen,

thanks for you comment, but the patch you attached reveals exactly the same behaviour as my attached patch also does, as you added the following assertion:

{code}
List<?> foundSendEmails = jpaTemplate.find(SELECT_ALL_STRING);
assertTrue("Expect table 3 elements in SendEmail, was: " + foundSendEmails.size(), foundSendEmails.size() == 3);
{code}

And this is *exactly* what I do *NOT* expect. Apparently according to what Claus said, the transaction should have been *rollbacked*. So after the routing of those 3 payloads completes the transaction through the spring's JpaTransactionManager should have been *rollbacked*, *but it's NOT*, as there're three rows on that table having the addresses 'foo@beer.org', 'bar@beer.org', and 'kaboom@beer.org'.

Maybe it's because of my poor english why I don't get the point. Anyone available who could explain it to me in german, or may be even better in my mother tongue persian :-)

Thanks anyway.
                
      was (Author: bvahdat):
    @Prebsen,

thanks for you comment, but the patch you attached reveals exactly the same behaviour as my attached patch also does, as you added the following assertion:

{code}
List<?> foundSendEmails = jpaTemplate.find(SELECT_ALL_STRING);
assertTrue("Expect table 3 elements in SendEmail, was: " + foundSendEmails.size(), foundSendEmails.size() == 3);
{code}

And this is *exactly* what I do *NOT* expect. Apparently according to what Claus said, the transaction has been already *rollbacked*. So after the routing completes the transaction through the spring's JpaTransactionManager should have been *rollbacked*, *but it's NOT*, as there're three rows on that table having the addresses 'foo@beer.org', 'bar@beer.org', and 'kaboom@beer.org'.

Maybe it's because of my poor english why I don't get the point. Anyone available who could explain it to me in german, or may be even better in my mother tongue persian :-)

Thanks anyway.
                  
> JpaConsumer - Should rollback if processing of an exchange failed
> -----------------------------------------------------------------
>
>                 Key: CAMEL-4668
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4668
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jpa
>    Affects Versions: 2.7.4, 2.8.2
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.7.5, 2.8.3, 2.9.0
>
>         Attachments: JpaTXRollbackTest.patch, JpaTXRollbackTest2.patch
>
>
> If a JPA consumer pickup X messages and then one of those messages fails to be processed and throws an exception, then the JPA consumer should detect this and mark the TX as rollback.
> Currently there is a flaw which causes the JPA consumer to commit the batch.
> See nabble
> http://camel.465427.n5.nabble.com/Misleading-jmx-statistics-on-jpa-component-tp4960503p4960503.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (CAMEL-4668) JpaConsumer - Should rollback if processing of an exchange failed

Posted by "Claus Ibsen (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4668?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-4668.
--------------------------------

    Resolution: Fixed
    
> JpaConsumer - Should rollback if processing of an exchange failed
> -----------------------------------------------------------------
>
>                 Key: CAMEL-4668
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4668
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jpa
>    Affects Versions: 2.7.4, 2.8.2
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.7.5, 2.8.3, 2.9.0
>
>
> If a JPA consumer pickup X messages and then one of those messages fails to be processed and throws an exception, then the JPA consumer should detect this and mark the TX as rollback.
> Currently there is a flaw which causes the JPA consumer to commit the batch.
> See nabble
> http://camel.465427.n5.nabble.com/Misleading-jmx-statistics-on-jpa-component-tp4960503p4960503.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CAMEL-4668) JpaConsumer - Should rollback if processing of an exchange failed

Posted by "Babak Vahdat (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4668?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Babak Vahdat updated CAMEL-4668:
--------------------------------

    Attachment: JpaTXRollbackTest.patch
    
> JpaConsumer - Should rollback if processing of an exchange failed
> -----------------------------------------------------------------
>
>                 Key: CAMEL-4668
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4668
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jpa
>    Affects Versions: 2.7.4, 2.8.2
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.7.5, 2.8.3, 2.9.0
>
>         Attachments: JpaTXRollbackTest.patch
>
>
> If a JPA consumer pickup X messages and then one of those messages fails to be processed and throws an exception, then the JPA consumer should detect this and mark the TX as rollback.
> Currently there is a flaw which causes the JPA consumer to commit the batch.
> See nabble
> http://camel.465427.n5.nabble.com/Misleading-jmx-statistics-on-jpa-component-tp4960503p4960503.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4668) JpaConsumer - Should rollback if processing of an exchange failed

Posted by "Babak Vahdat (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13148505#comment-13148505 ] 

Babak Vahdat commented on CAMEL-4668:
-------------------------------------

But if I start the route as the first step in the test method it *still* passes:

{code}
    @Test
    public void testTXRollback() throws Exception {
        // start route
        context.startRoute("foo");

        // first create three records
        template.sendBody("jpa://" + SendEmail.class.getName(), new SendEmail("foo@beer.org"));
        template.sendBody("jpa://" + SendEmail.class.getName(), new SendEmail("bar@beer.org"));
        template.sendBody("jpa://" + SendEmail.class.getName(), new SendEmail("kaboom@beer.org"));

        // should rollback the entire
        MockEndpoint mock = getMockEndpoint("mock:result");
        // we should retry and try again
        mock.expectedMinimumMessageCount(4);

        assertMockEndpointsSatisfied();

        assertTrue("Should be >= 2, was: " + foo.intValue(), foo.intValue() >= 2);
        assertTrue("Should be >= 2, was: " + bar.intValue(), bar.intValue() >= 2);
    }

{code}
                
> JpaConsumer - Should rollback if processing of an exchange failed
> -----------------------------------------------------------------
>
>                 Key: CAMEL-4668
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4668
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jpa
>    Affects Versions: 2.7.4, 2.8.2
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.7.5, 2.8.3, 2.9.0
>
>
> If a JPA consumer pickup X messages and then one of those messages fails to be processed and throws an exception, then the JPA consumer should detect this and mark the TX as rollback.
> Currently there is a flaw which causes the JPA consumer to commit the batch.
> See nabble
> http://camel.465427.n5.nabble.com/Misleading-jmx-statistics-on-jpa-component-tp4960503p4960503.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4668) JpaConsumer - Should rollback if processing of an exchange failed

Posted by "Babak Vahdat (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13149281#comment-13149281 ] 

Babak Vahdat commented on CAMEL-4668:
-------------------------------------

@Prebsen,

thanks for you comment, but the patch you attached reveals exactly the same behaviour as my attached patch also does, as you added the following assertion:

{code}
List<?> foundSendEmails = jpaTemplate.find(SELECT_ALL_STRING);
assertTrue("Expect table 3 elements in SendEmail, was: " + foundSendEmails.size(), foundSendEmails.size() == 3);
{code}

And this is *exactly* what I do *NOT* expect. Apparently according to what Claus said, the transaction has been already *rollbacked*. So after the routing completes the transaction through the spring's JpaTransactionManager should have been *rollbacked*, *but it's NOT*, as there're three rows on that table having the addresses 'foo@beer.org', 'bar@beer.org', and 'kaboom@beer.org'.

Maybe it's because of my poor english why I don't get the point. Anyone available who could explain it to me in german, or may be even better in my mother tongue persian :-)

Thanks anyway.
                
> JpaConsumer - Should rollback if processing of an exchange failed
> -----------------------------------------------------------------
>
>                 Key: CAMEL-4668
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4668
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jpa
>    Affects Versions: 2.7.4, 2.8.2
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.7.5, 2.8.3, 2.9.0
>
>         Attachments: JpaTXRollbackTest.patch, JpaTXRollbackTest2.patch
>
>
> If a JPA consumer pickup X messages and then one of those messages fails to be processed and throws an exception, then the JPA consumer should detect this and mark the TX as rollback.
> Currently there is a flaw which causes the JPA consumer to commit the batch.
> See nabble
> http://camel.465427.n5.nabble.com/Misleading-jmx-statistics-on-jpa-component-tp4960503p4960503.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4668) JpaConsumer - Should rollback if processing of an exchange failed

Posted by "Claus Ibsen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13148503#comment-13148503 ] 

Claus Ibsen commented on CAMEL-4668:
------------------------------------

Its 2 different things:
1: The template send 3 messages to INSERT data into the database.
2: Then the route is started, which starts the consumer, it then pickup the 3 messages. And fail processing the last message. Which forces all 3 to rollback. So when it poll again, it find the 3 messages, and try again etc.

                
> JpaConsumer - Should rollback if processing of an exchange failed
> -----------------------------------------------------------------
>
>                 Key: CAMEL-4668
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4668
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jpa
>    Affects Versions: 2.7.4, 2.8.2
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.7.5, 2.8.3, 2.9.0
>
>
> If a JPA consumer pickup X messages and then one of those messages fails to be processed and throws an exception, then the JPA consumer should detect this and mark the TX as rollback.
> Currently there is a flaw which causes the JPA consumer to commit the batch.
> See nabble
> http://camel.465427.n5.nabble.com/Misleading-jmx-statistics-on-jpa-component-tp4960503p4960503.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (CAMEL-4668) JpaConsumer - Should rollback if processing of an exchange failed

Posted by "Babak Vahdat (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13148505#comment-13148505 ] 

Babak Vahdat edited comment on CAMEL-4668 at 11/11/11 2:16 PM:
---------------------------------------------------------------

But if I start the route as the first step in the test method it *still* passes:

{code}
    @Test
    public void testTXRollback() throws Exception {
        // start route
        context.startRoute("foo");

        // first create three records
        template.sendBody("jpa://" + SendEmail.class.getName(), new SendEmail("foo@beer.org"));
        template.sendBody("jpa://" + SendEmail.class.getName(), new SendEmail("bar@beer.org"));
        template.sendBody("jpa://" + SendEmail.class.getName(), new SendEmail("kaboom@beer.org"));

        // should rollback the entire
        MockEndpoint mock = getMockEndpoint("mock:result");
        // we should retry and try again
        mock.expectedMinimumMessageCount(4);

        assertMockEndpointsSatisfied();

        assertTrue("Should be >= 2, was: " + foo.intValue(), foo.intValue() >= 2);
        assertTrue("Should be >= 2, was: " + bar.intValue(), bar.intValue() >= 2);
    }

{code}

And what I've learned is that the call at the line:
{code}
template.sendBody("jpa://" + SendEmail.class.getName(), new SendEmail("kaboom@beer.org"));
{code}

should now blow up with a CamelExecutionException but still it doesn't!
                
      was (Author: bvahdat):
    But if I start the route as the first step in the test method it *still* passes:

{code}
    @Test
    public void testTXRollback() throws Exception {
        // start route
        context.startRoute("foo");

        // first create three records
        template.sendBody("jpa://" + SendEmail.class.getName(), new SendEmail("foo@beer.org"));
        template.sendBody("jpa://" + SendEmail.class.getName(), new SendEmail("bar@beer.org"));
        template.sendBody("jpa://" + SendEmail.class.getName(), new SendEmail("kaboom@beer.org"));

        // should rollback the entire
        MockEndpoint mock = getMockEndpoint("mock:result");
        // we should retry and try again
        mock.expectedMinimumMessageCount(4);

        assertMockEndpointsSatisfied();

        assertTrue("Should be >= 2, was: " + foo.intValue(), foo.intValue() >= 2);
        assertTrue("Should be >= 2, was: " + bar.intValue(), bar.intValue() >= 2);
    }

{code}
                  
> JpaConsumer - Should rollback if processing of an exchange failed
> -----------------------------------------------------------------
>
>                 Key: CAMEL-4668
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4668
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jpa
>    Affects Versions: 2.7.4, 2.8.2
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.7.5, 2.8.3, 2.9.0
>
>
> If a JPA consumer pickup X messages and then one of those messages fails to be processed and throws an exception, then the JPA consumer should detect this and mark the TX as rollback.
> Currently there is a flaw which causes the JPA consumer to commit the batch.
> See nabble
> http://camel.465427.n5.nabble.com/Misleading-jmx-statistics-on-jpa-component-tp4960503p4960503.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (CAMEL-4668) JpaConsumer - Should rollback if processing of an exchange failed

Posted by "Babak Vahdat (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13148505#comment-13148505 ] 

Babak Vahdat edited comment on CAMEL-4668 at 11/11/11 2:38 PM:
---------------------------------------------------------------

But if I start the route as the first step in the test method it *still* passes:

{code}
    @Test
    public void testTXRollback() throws Exception {
        // start route
        context.startRoute("foo");

        // first create three records
        template.sendBody("jpa://" + SendEmail.class.getName(), new SendEmail("foo@beer.org"));
        template.sendBody("jpa://" + SendEmail.class.getName(), new SendEmail("bar@beer.org"));
        template.sendBody("jpa://" + SendEmail.class.getName(), new SendEmail("kaboom@beer.org"));

        // should rollback the entire
        MockEndpoint mock = getMockEndpoint("mock:result");
        // we should retry and try again
        mock.expectedMinimumMessageCount(4);

        assertMockEndpointsSatisfied();

        assertTrue("Should be >= 2, was: " + foo.intValue(), foo.intValue() >= 2);
        assertTrue("Should be >= 2, was: " + bar.intValue(), bar.intValue() >= 2);
    }

{code}

And what I've learned is that the call at the line:
{code}
template.sendBody("jpa://" + SendEmail.class.getName(), new SendEmail("kaboom@beer.org"));
{code}

should at the latest by now blow up with a CamelExecutionException but still it doesn't!
                
      was (Author: bvahdat):
    But if I start the route as the first step in the test method it *still* passes:

{code}
    @Test
    public void testTXRollback() throws Exception {
        // start route
        context.startRoute("foo");

        // first create three records
        template.sendBody("jpa://" + SendEmail.class.getName(), new SendEmail("foo@beer.org"));
        template.sendBody("jpa://" + SendEmail.class.getName(), new SendEmail("bar@beer.org"));
        template.sendBody("jpa://" + SendEmail.class.getName(), new SendEmail("kaboom@beer.org"));

        // should rollback the entire
        MockEndpoint mock = getMockEndpoint("mock:result");
        // we should retry and try again
        mock.expectedMinimumMessageCount(4);

        assertMockEndpointsSatisfied();

        assertTrue("Should be >= 2, was: " + foo.intValue(), foo.intValue() >= 2);
        assertTrue("Should be >= 2, was: " + bar.intValue(), bar.intValue() >= 2);
    }

{code}

And what I've learned is that the call at the line:
{code}
template.sendBody("jpa://" + SendEmail.class.getName(), new SendEmail("kaboom@beer.org"));
{code}

should now blow up with a CamelExecutionException but still it doesn't!
                  
> JpaConsumer - Should rollback if processing of an exchange failed
> -----------------------------------------------------------------
>
>                 Key: CAMEL-4668
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4668
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jpa
>    Affects Versions: 2.7.4, 2.8.2
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.7.5, 2.8.3, 2.9.0
>
>
> If a JPA consumer pickup X messages and then one of those messages fails to be processed and throws an exception, then the JPA consumer should detect this and mark the TX as rollback.
> Currently there is a flaw which causes the JPA consumer to commit the batch.
> See nabble
> http://camel.465427.n5.nabble.com/Misleading-jmx-statistics-on-jpa-component-tp4960503p4960503.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-4668) JpaConsumer - Should rollback if processing of an exchange failed

Posted by "Preben Asmussen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13149273#comment-13149273 ] 

Preben Asmussen commented on CAMEL-4668:
----------------------------------------

@Babak

When you send using the template the records are inserted in its own tx so they should be committed as base for the test to run, and not rolled back. See attached patch.

I'm still not happy about the jmx stats though. 
                
> JpaConsumer - Should rollback if processing of an exchange failed
> -----------------------------------------------------------------
>
>                 Key: CAMEL-4668
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4668
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jpa
>    Affects Versions: 2.7.4, 2.8.2
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.7.5, 2.8.3, 2.9.0
>
>         Attachments: JpaTXRollbackTest.patch
>
>
> If a JPA consumer pickup X messages and then one of those messages fails to be processed and throws an exception, then the JPA consumer should detect this and mark the TX as rollback.
> Currently there is a flaw which causes the JPA consumer to commit the batch.
> See nabble
> http://camel.465427.n5.nabble.com/Misleading-jmx-statistics-on-jpa-component-tp4960503p4960503.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (CAMEL-4668) JpaConsumer - Should rollback if processing of an exchange failed

Posted by "Claus Ibsen (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4668?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated CAMEL-4668:
-------------------------------

    Affects Version/s: 2.7.4
        Fix Version/s: 2.7.5
    
> JpaConsumer - Should rollback if processing of an exchange failed
> -----------------------------------------------------------------
>
>                 Key: CAMEL-4668
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4668
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jpa
>    Affects Versions: 2.7.4, 2.8.2
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.7.5, 2.8.3, 2.9.0
>
>
> If a JPA consumer pickup X messages and then one of those messages fails to be processed and throws an exception, then the JPA consumer should detect this and mark the TX as rollback.
> Currently there is a flaw which causes the JPA consumer to commit the batch.
> See nabble
> http://camel.465427.n5.nabble.com/Misleading-jmx-statistics-on-jpa-component-tp4960503p4960503.html

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira