1 Reply Latest reply on Apr 29, 2019 1:12 PM by Ondrej Chaloupka

    Newbie's questions about lra-examples?

    ZHANG GUOFENG Newbie

      Hi,

       

      I tried to understand how LRA working, so I tried to build lra-examples, version 5.9.5 final.branch/

      1) The following artifacts missed:

      microprofile.lra, version 1.0-20190122.071206-242

      lra-service-base.

       

      2) How does the LRA coordinator work with @Compensate/@Complete annotation?

       

      For the following example:

      @PUT

      @Path("/compensate")

      @Compensate

       

      does this mean that the coordinator will use Http PUT to call /compensate for the compensation?, can I use the name other than "compensate" for the API call?

       

      If the coordinator use Http PUT for the compensation, How does it know that it should pass the bear token for authorization for the API call if the other API call use bear token for authorization?

       

      Thanks for your help.

       

      Guofeng

       

      lra-service-base

        • 1. Re: Newbie's questions about lra-examples?
          Ondrej Chaloupka Master

          Hi guofengzh1 ,

           

          thank you for asking.

           

          1) The following artifacts missed:

          microprofile.lra, version 1.0-20190122.071206-242

          lra-service-base.

          The LRA is in a rapid development so there are still some moving parts. We really strive to get LRA 1.0 being released and with that getting a stable Narayana implementation we can refer to.

          The 5.9.5.Final release refers to the MicroProfile LRA SNAPSHOT version provided by the Eclipse foundation. These SNAPSHOT versions are deleted after one moth. The artifact from the 2019-01-22 does not exists in the artifact repository anymore.

          The spec has changed quite a lot since then but is reasonable stable now. If you can be patient we can update the quickstarts for your experiments. It will be expected to compile the Narayana implementation from sources then.

           

          2) How does the LRA coordinator work with @Compensate/@Complete annotation?

          does this mean that the coordinator will use Http PUT to call /compensate for the compensation?, can I use the name other than "compensate" for the API call?

          Yes, it works as you expect. The coordinator uses HTTP PUT to call the compensate endpoint. You can define the @Path as you wish. The participant will be registered to the coordinator with the path you declare. But the HTTP method is expected to be @PUT and that's fixed.

          Edit: there was created an issue to be more flexible about the HTTP methods, see Allow JAX-RS endpoints Complete/Compensate to be invoked using any HTTP method · Issue #146 · eclipse/microprofile-lra ·…

           

          If the coordinator use Http PUT for the compensation, How does it know that it should pass the bear token for authorization for the API call if the other API call use bear token for authorization?

          The LRA currently does cover the autorization in any way. There is a discussion on this at the spec github, see the Spec: Describe security requirements of the JAX-RS endpoint generated by the Proxy participant. · Issue #131 · eclipse/m….

          There is no expectation the security concern to be addressed in the 1.0. But it's possible and desirable to be considered for some of the next releases. You will be more than welcome to contribute with ideas. Feel free to discuss your concern on the eclipse/microprofile-lra - Gitter  or through the github issue Issues · eclipse/microprofile-lra · GitHub  or you can join the weekly meeting.

           

          Ondra