Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-13637

Support JUEL delegate expressions in Quarkus

    • Icon: Feature Request Feature Request
    • Resolution: Unresolved
    • Icon: L3 - Default L3 - Default
    • None
    • None
    • quarkus
    • None

      User Story (Required on creation):

      As a user, in modeling resources (e.g., on sequence flows), I can define expressions that call methods on a bean.

      Functional Requirements (Required before implementation):

      E.g., in a sequence flow camunda:expression attribute, I can use the following expression:
      ${myService.checkCondition('foo')}

      Technical Requirements (Required before implementation):

      Quarkus ArC does not support the API method BeanManager#getELResolver. Replace it with something else.

      Limitations of Scope (Optional):

      Hints (Optional):

      Right now, only a simple JUEL expression referencing a delegate bean directly can be resolved: ${myDelegateBean}. Referencing a delegate bean via a more complex expression is not possible ${myBean.getDelegateBean()} due to missing support in Quarkus ArC of BeanManager#getELResolver. Let's evaluate if and how we can fix this.

      Solution ideas

      1. Shade de.odysseus.juel into the Quarkus extension like we already do it in the legacy JUEL FEEL Engine.
        • Or even cleaner: create a shaded jar containing de.odysseus.juel the DMN legacy FEEL Engine, as well as Quarkus, uses.
        • Identify Quarkus environment by catching the UnsupportedOperationException when BeanManager#getELResolver is called in CdiResolver#getWrappedResolver.
        • Register the javax.el.BeanELResolver instead.
          • Tries to create a ExpressionFactory by looking up the SPI.
        • Register an ExpressionFactory SPI in the Qurkus extension pointing to de.odysseus.el.ExpressionFactoryImpl.
        • See prototypical implementation (shading is missing): fix-quarkus-el-support.patch.txt
      2. Wait until Quarkus supports BeanManager#getELResolver

        This is the controller panel for Smart Panels app

            [CAM-13637] Support JUEL delegate expressions in Quarkus

            We are heavily reliant on method expressions, so upvoting this for future inclusion.

            Tiese Barrell added a comment - We are heavily reliant on method expressions, so upvoting this for future inclusion.

            Tassilo Weidner added a comment - - edited

            Even though this feature request is yet not resolved, it is possible to already use the alternative solution by applying the following configurations to your Quarkus Application.

            1. Configure the process engine accordingly:

            @ApplicationScoped
            public class MyConfig {
            
              @Produces
              public QuarkusProcessEngineConfiguration customEngineConfig() {
            
                return new QuarkusProcessEngineConfiguration() {
            
                  @Override
                  protected void initExpressionManager() {
                    expressionManager = new ExpressionManager() {
                      protected ELResolver createElResolver() {
                        CompositeELResolver compositeElResolver = new CompositeELResolver();
                        compositeElResolver.add(new VariableScopeElResolver());
                        compositeElResolver.add(new VariableContextElResolver());
                        compositeElResolver.add(new CdiResolver() {
                          protected javax.el.ELResolver getWrappedResolver() {
                            return new javax.el.BeanELResolver();
                          }
                        });
                        compositeElResolver.add(new ArrayELResolver());
                        compositeElResolver.add(new ListELResolver());
                        compositeElResolver.add(new MapELResolver());
                        compositeElResolver.add(new BeanELResolver());
                        return compositeElResolver;
                      }
                    };
                    this.expressionManager.addFunctionMapper(new CommandContextFunctionMapper());
                    this.expressionManager.addFunctionMapper(new DateTimeFunctionMapper());
                  }
                };
            
              }
            
            }
            

            2. Add a JUEL implementation by adding the following dependencies to your `pom.xml` file:

                <dependency>
                  <groupId>de.odysseus.juel</groupId>
                  <artifactId>juel-api</artifactId>
                  <version>2.2.7</version>
                </dependency>
            
                <dependency>
                  <groupId>de.odysseus.juel</groupId>
                  <artifactId>juel-spi</artifactId>
                  <version>2.2.7</version>
                </dependency>
            
                <dependency>
                  <groupId>de.odysseus.juel</groupId>
                  <artifactId>juel-impl</artifactId>
                  <version>2.2.7</version>
                </dependency>
            

            3. Configure a service loader in src/main/resources/META-INF/services/javax.el.ExpressionFactory with de.odysseus.el.ExpressionFactoryImpl

            Tassilo Weidner added a comment - - edited Even though this feature request is yet not resolved, it is possible to already use the alternative solution by applying the following configurations to your Quarkus Application. 1. Configure the process engine accordingly: @ApplicationScoped public class MyConfig {   @Produces   public QuarkusProcessEngineConfiguration customEngineConfig() {     return new QuarkusProcessEngineConfiguration() {       @Override       protected void initExpressionManager() {         expressionManager = new ExpressionManager() {           protected ELResolver createElResolver() {             CompositeELResolver compositeElResolver = new CompositeELResolver();             compositeElResolver.add( new VariableScopeElResolver());             compositeElResolver.add( new VariableContextElResolver());             compositeElResolver.add( new CdiResolver() {               protected javax.el.ELResolver getWrappedResolver() {                 return new javax.el.BeanELResolver();               }             });             compositeElResolver.add( new ArrayELResolver());             compositeElResolver.add( new ListELResolver());             compositeElResolver.add( new MapELResolver());             compositeElResolver.add( new BeanELResolver());             return compositeElResolver;           }         };         this .expressionManager.addFunctionMapper( new CommandContextFunctionMapper());         this .expressionManager.addFunctionMapper( new DateTimeFunctionMapper());       }     };   } } 2. Add a JUEL implementation by adding the following dependencies to your `pom.xml` file:     <dependency>       <groupId> de.odysseus.juel </groupId>       <artifactId> juel-api </artifactId>       <version> 2.2.7 </version>     </dependency>     <dependency>       <groupId> de.odysseus.juel </groupId>       <artifactId> juel-spi </artifactId>       <version> 2.2.7 </version>     </dependency>     <dependency>       <groupId> de.odysseus.juel </groupId>       <artifactId> juel-impl </artifactId>       <version> 2.2.7 </version>     </dependency> 3. Configure a service loader in src/main/resources/META-INF/services/javax.el.ExpressionFactory with de.odysseus.el.ExpressionFactoryImpl

            This ticket was migrated to github: https://github.com/camunda/camunda-bpm-platform/issues/2610. Please use this link for any future references and continue any discussion there.

            Thorben Lindhauer added a comment - This ticket was migrated to github: https://github.com/camunda/camunda-bpm-platform/issues/2610 . Please use this link for any future references and continue any discussion there.

              Unassigned Unassigned
              tassilo.weidner Tassilo Weidner
              Votes:
              4 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated: