[
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("[email protected]"));
template.sendBody("jpa://" + SendEmail.class.getName(), new
SendEmail("[email protected]"));
template.sendBody("jpa://" + SendEmail.class.getName(), new
SendEmail("[email protected]"));
// 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("[email protected]"));
{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("[email protected]"));
template.sendBody("jpa://" + SendEmail.class.getName(), new
SendEmail("[email protected]"));
template.sendBody("jpa://" + SendEmail.class.getName(), new
SendEmail("[email protected]"));
// 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