Uploaded image for project: 'OpenWebBeans'
  1. OpenWebBeans
  2. OWB-1319

Implement lightweight CDI-centric HTTP server + allow build-time CDI proxy generation



    • Type: New Feature
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:


      Apache OpenWebBeans (OWB) is a IoC container implementing CDI (Java Contexts and Dependency Injection) specification.



      With the rise of Kubernetes and more generally the Cloud adoption, it becomes more and more key to be able to have fast, light and reliable servers.
      That ecosystem is mainly composed of Microprofile servers.
      However their stack is quite huge for most applications and OpenWebBeans-based Microprofile server are not CDI centric (Meecrowave and TomEE are Tomcat centric).

      This is why the need of a light HTTP server (likely Netty based), embeddable in CDI context (as a bean) comes.
      It will be close to a light embedded servlet container but likely more reactive in the way the server will need to scale.
      It must handle fixed size payload (with Content-Length header) but also chunking.

      This task will require:

      1. define a lightweight HTTP API
        • start with the most essential features
        • at least supporting filter like interception, even interceptor based but in a reactive fashion (CompletionStage)
        • optional, if there is enough time left: add features like fileupload support
      2. implement the API (marry our API / CDI / OWB / Netty)
      3. make it configurable
        • via code / builder pattern
        • optional, if there is enough time left: via Micoprofile Config



      Once this light server is ready, the next step for a Java application to embrace the cloud is to make it native runnable.
      Today OWB generates the class proxies, which are required per CDI specs to enable features like Interception and Decoration, lazy in runtime-mode.
      A native-image can be generated via the "native-image" cmd tool from GraalVM, where you can include the classpath. This classpath must contain the generated class-proxies as the generated nativeimage can't generate bytecode anymore.
      It's not a trivial task to enable OWB to create proxies in buildtime.

      This task will require:

      1. change the "dynamic" classname generation to "static", otherwise we can't rely on the classname when lookup the proxyclass
      2. implement a proxy SPI in OWB, to enable to load pre-generated proxies instead of generate them in runtime
      3. implement a BuildTimeProxyGenerator class
        • it should accept a list of beans (bean class + interceptor classes + decorator classes)
        • optional, if there is enough time left: later we can add a more complex solution which also scanns the classpath for beans

      In scope of this project, it's enough to manually call the BuildTimeProxyGenerator via a Runnable (with a companion main(String[])) and add the generated proxies in the classpath of the "native-image" cmd.


      You should know:
      • Java
      • HTTP


      Difficulty: Major

      mentors: tandraschko@apache.org, rmannibucau@apache.org
      Potential mentors:
      Project Devs, mail: dev (at) openwebbeans.apache.org




            • Assignee:
              tandraschko Thomas Andraschko
              tandraschko Thomas Andraschko
            • Votes:
              1 Vote for this issue
              2 Start watching this issue


              • Created: