[
https://issues.jboss.org/browse/JBTM-3065?page=com.atlassian.jira.plugin....
]
Michael Musgrove updated JBTM-3065:
-----------------------------------
Description:
The LRA spec supports starting LRA's via a Java API or via Java annotations. If the
two approaches are used together in the same resource method then the LRA started via the
API should be nested inside the one started by an annotation.
If the annotated class also contains @Compensate and @Complete annotations (which means
that the resource should join the outer LRA) and the resource method Joins the nested LRA
then the resource should receive callbacks for both the outer and nested LRA's.
The following code shows an example:
{code}
@PUT
@LRA(LRA.Type.REQUIRES_NEW) // starts a new LRA on entry
public String doInTransaction() {
URL lraId = lraClient.startLRA(...); // starts a nested LRA
lraClient.join(...) // join the nested LRA
lraClient.closeLRA(lraId); // close the nested LRA
// assert that the nested callbacks were invoked
// assert that the callbacks for the outer LRA have not been called yet
}
{code}
Similar comments apply if the resource joins via the LRAManagement API:
{code}
@Inject
private LRAManagement lraManagement;
public String doInTransaction() {
lraManagement.joinLRA(this, lraId, 0L, TimeUnit.SECONDS);
// etc
{code}
was:
The LRA spec supports starting LRA's via a Java API or via Java annotations. If the
two approaches are used together in the same resource method then the LRA started via the
API should be nested inside the one started by an annotation.
If the annotated class also contains @Compensate and @Complete annotations (which means
that the resource should join the outer LRA) and the resource method Joins the nested LRA
then the resource should receive callbacks for both the outer and nested LRA's.
The following code shows an example:
{code}
@PUT
@LRA(LRA.Type.REQUIRES_NEW) // starts a new LRA on entry
public String doInTransaction() {
URL lraId = lraClient.startLRA(...); // starts a nested LRA
lraClient.join(...) // join the nested LRA
lraClient.closeLRA(lraId); // close the nested LRA
}
{code}
Similar comments apply if the resource joins via the LRAManagement API:
{code}
@Inject
private LRAManagement lraManagement;
public String doInTransaction() {
lraManagement.joinLRA(this, lraId, 0L, TimeUnit.SECONDS);
// etc
{code}
Check that starting LRA's via CDI and API in the same method
works
------------------------------------------------------------------
Key: JBTM-3065
URL:
https://issues.jboss.org/browse/JBTM-3065
Project: JBoss Transaction Manager
Issue Type: Bug
Components: LRA
Affects Versions: 5.9.0.Final
Reporter: Michael Musgrove
Assignee: Michael Musgrove
Priority: Major
Fix For: 5.next
The LRA spec supports starting LRA's via a Java API or via Java annotations. If the
two approaches are used together in the same resource method then the LRA started via the
API should be nested inside the one started by an annotation.
If the annotated class also contains @Compensate and @Complete annotations (which means
that the resource should join the outer LRA) and the resource method Joins the nested LRA
then the resource should receive callbacks for both the outer and nested LRA's.
The following code shows an example:
{code}
@PUT
@LRA(LRA.Type.REQUIRES_NEW) // starts a new LRA on entry
public String doInTransaction() {
URL lraId = lraClient.startLRA(...); // starts a nested LRA
lraClient.join(...) // join the nested LRA
lraClient.closeLRA(lraId); // close the nested LRA
// assert that the nested callbacks were invoked
// assert that the callbacks for the outer LRA have not been called yet
}
{code}
Similar comments apply if the resource joins via the LRAManagement API:
{code}
@Inject
private LRAManagement lraManagement;
public String doInTransaction() {
lraManagement.joinLRA(this, lraId, 0L, TimeUnit.SECONDS);
// etc
{code}
--
This message was sent by Atlassian Jira
(v7.12.1#712002)