Questions about Eclipse Microprofile-LRA

92 views
Skip to first unread message

Max Grabert

unread,
Jun 6, 2019, 7:25:26 AM6/6/19
to Eclipse MicroProfile

Hello all,

 

In preparation for a short presentation I have some questions regarding the spec and implementation of the Eclipse Microprofile-LRA:

  

  1. Is https://github.com/jbosstm/narayana/tree/master/rts/lra the only implementation so far and is it the reference implementation for Eclipse-Microprofile-LRA?

  2. Is the TCK project meant to be a (reference) example of how to use the Eclipse Microprofile-LRA, or is it supposed to be a tool to validate (this or any) implementation against the spec?

 

  1. In the spec the method getActivity() is being referenced in the examples (3.2.4), but no further information about it, or the classes Activity or ActivityStore is being described.
    Is getActivity() / ActivityStore / Activity part of the spec and guaranteed in the implementation and where can you find more details about it (apart from the TCK sources)?

  2. Once there is a timeout of error of a LRA, the compensatory action supposed to be automatically triggered (when all is annotated correctly). Some questions:
    1. Using JAX-RS, how can the compensation method acquire the user data that is needed to do its work?
      i.e. it needs to figure out what had been previously done (with which data) and what needs to be undone and how, and per spec it will be just passed the LRA_HTTP_CONTEXT_HEADER (lraId).
      Is the programmer responsible to store/manage all relevant user data himself, i.e. does he has to implement a persistent storage for this an a mapping to the lraId?

    2. Related: there is a Activity.getUserData() and also in the spec there are examples (3.2.3), where the compensation method has the parameter “String userData”.
      Where does it get this userData, is it automatically provided via the ActivityStore (e.g. if a LRA was setting user data before with getActivity(lraId).setUserData()) ?

    3. Is there a way for the compensation method to find out, if it was called because of a timeout or any other error?


I guess some of the information is hidden somewhere in the sources since it is all work-in-progress, and for an outsider like me it is not so easy to find my way around.


Thanks a lot for you answers,
   Max Grabert

Michael Musgrove

unread,
Jun 6, 2019, 11:21:27 AM6/6/19
to Eclipse MicroProfile

On Thursday, 6 June 2019 12:25:26 UTC+1, Max Grabert wrote:

Hello all,

 

In preparation for a short presentation I have some questions regarding the spec and implementation of the Eclipse Microprofile-LRA:

  

  1. Is https://github.com/jbosstm/narayana/tree/master/rts/lra the only implementation so far and is it the reference implementation for Eclipse-Microprofile-LRA?
We don't have reference implementations, ie anyone can implement it (but they should also pass the TCK). Ideally when different implementations are deployed onto a MicroProfile platform they would interoperate (but we will not make that a priority until milestone 2 of the project:  see issues https://github.com/eclipse/microprofile-lra/issues/17 and https://github.com/eclipse/microprofile-lra/issues/62)
Payara also have an implementation (and its design is sufficiently different from the narayana implementation to give confidence that the spec is not tied to just one)
 
  1. Is the TCK project meant to be a (reference) example of how to use the Eclipse Microprofile-LRA, or is it supposed to be a tool to validate (this or any) implementation against the spec?

No it is not - it's a Technology Compatibility Kit to validate that a particular implementation complies with the specification

 

  1. In the spec the method getActivity() is being referenced in the examples (3.2.4), but no further information about it, or the classes Activity or ActivityStore is being described.
    Is getActivity() / ActivityStore / Activity part of the spec and guaranteed in the implementation and where can you find more details about it (apart from the TCK sources)?

Those methods are in the TCK which are only present for testing spec compliance of an spec implementation.
An application is meant to depend only on the API classes which is then deployed into a MicroProfile container/platform that already contains an implementation of the LRA specification. For example the Narayana implementation will install JAX-RS filters when the application is deployed and these filters will enforce the requirements of the spec transparently to the deployed application. [The developer just annotates which methods he would like to take part in a long running action (LRA) using the @LRA annotation and in the same class annotates methods that should be invoked by the spec implementation when the LRA is later closed or cancelled (we say that these methods are `registered` with the LRA). An LRA can be closed or cancelled when a method finishes by setting an element on the LRA annotation which causes the relevant callback to be triggered].
 
  1. Once there is a timeout of error of a LRA, the compensatory action supposed to be automatically triggered (when all is annotated correctly). Some questions:
    1. Using JAX-RS, how can the compensation method acquire the user data that is needed to do its work?
      i.e. it needs to figure out what had been previously done (with which data) and what needs to be undone and how, and per spec it will be just passed the LRA_HTTP_CONTEXT_HEADER (lraId).
      Is the programmer responsible to store/manage all relevant user data himself, i.e. does he has to implement a persistent storage for this an a mapping to the lraId?

In milestone 1 yes. The compensation method is always called in the context of an LRA which can be accessed via a JAX-RS header. As you correctly pointed out, the application should associate any required data (that it needs to be able to compensate/clean up) with this LRA id and he should make it durable in order to guarantee that it can still compensate correctly even in the case of failures.

But for milestone 2 the application developer will be allowed to associate arbitrary opaque data at the time of registration (https://github.com/eclipse/microprofile-lra/issues/15) and the spec implementation will ensure that it is returned to the application when the compensation callback is invoked.
 
    1. Related: there is a Activity.getUserData() and also in the spec there are examples (3.2.3), where the compensation method has the parameter “String userData”.
      Where does it get this userData, is it automatically provided via the ActivityStore (e.g. if a LRA was setting user data before with getActivity(lraId).setUserData()) ?
In an earlier version of the spec the userData was allowed to be supplied at the same time that a participant is registered with an active LRA. But we moved it to milestone 2. The parameter in the example that you refer to should have been removed too when we deferred the functionality (so thanks for spotting that). This is an open source project and if you think that this issue should be promoted to milestone 1 then please contribute reasons and we will vote on it (supporting the feature is straight forward since the spec implementation must already have a strategy for durably recording data in order to withstand system crashes).
 
    1. Is there a way for the compensation method to find out, if it was called because of a timeout or any other error?


No the spec just defines the triggers to guarantee atomic outcomes (but we can add it if you think that is something applications would find useful).
 
 

I guess some of the information is hidden somewhere in the sources since it is all work-in-progress, and for an outsider like me it is not so easy to find my way around.



The best place to look is the specification document (https://github.com/eclipse/microprofile-lra/blob/master/spec/src/main/asciidoc/microprofile-lra-spec.adoc) and the API (https://github.com/eclipse/microprofile-lra/tree/master/api). The spec is available as PDF (spec/target/generated-docs/microprofile-lra-spec.pdf) if you clone the git repo and type mvn package -f spec/pom.xml

We have some quickstarts in the narayana quickstarts repo, maybe we could look at moving those into the eclipse project (I will investigate whether or not that would make sense).

If you have some suggestions about how we can make the spec more readable that would be great too.
 

Thanks a lot for you answers,

You're welcome, questions help us to identify deficiencies in the spec.
Thanks 

   Max Grabert

Reply all
Reply to author
Forward
0 new messages