Details
-
Sub-task
-
Resolution: Done
-
L3 - Default
-
None
-
None
Description
User Story
I can use the feature set provided by the process engine CDI integration [1].
Functional Requirements
- Associate a conversation with a process instance [2] (might not be supported via @ConversationScoped, only via @RequestScoped)
- Controll the process declaratively [3]
- Work with @BusinessProcessScoped beans [4] (might not be supported due to Quarkus CDI limitations)
- Work with built-in beans (e.g., @Inject ProcessEngine, RuntimeService, ProcessInstance, Task) [5]
- Event Bridge [6]
Technical Constraints
- Quarkus.io supports only a subset of the CDI 2.0 standard with the help of the quarkus-arc module
- Please see the supported features [7] and limitations [8]
- Our CDI integration makes use of CDI concepts that are not supported by quarkus-arc
How we deal with limited CDI 2.0 support
- We thoroughly document to which extent and what features of the engine-cdi module work and whatnot
- We ensure that the working features are actually working by automated tests
- We provide an alternative configuration approach since the content of the beans.xml is ignored by Quarkus.io
- beans.xml is already not the preferred way of applying configurations; the state-of-the-art way is using annotations
Potentially Problematic Limitations
Disclaimer: The following things were identified based on the quarkus-arc limitations [8] documentation and evaluating the source code of our engine-cdi module. To get full confidence in what works and whatnot, we might need to execute the test suite of the engine-cdi module against Quarkus.io.
- The @ConversationScoped is not supported: Task forms and ConversationScopedAssociation uses it
- Only some methods of the BeanManager are supported
- beans.xml descriptor content is ignored
- Passivation and passivating scopes are not supported: @BusinessProcessScoped needs to be PassivationCapable
- Portable Extensions are not supported: ProcessEngineExtension uses the portable Extension interface
- Implicit bean discovery: DefaultContextAssociationManager, ProcessVariableLocalMap, ProcessVariableMap, BusinessProcess, ProcessVariables
- Explicit bean definition (annotation) on class level is missing
Solutions to mitigate limitations
- RE 1
- Document it and describe that association works within a request context (REST API call)
- RE 3
- Introduce configuration properties in the application.properties file to compensate what can be configured in the beans.xml file
- RE 6
- a) Add AdditionalBeanBuildItem in Quarkus.io extension which registers the classes with missing bean definition and assigns a scope
- b) Add bean definition directly to engine-cdi module (might break behavior)
Limitations discovered by running engine-cdi testsuite
- Most of the tests make heavy use of the @ConversationScoped bean behavior which is not supported by Quarkus.io
- However, Quarkus.io as well as engine-cdi support @RequestScoped beans
- This scope gets enabled e.g. when performing a REST request but also in other situations [9]
- When activating the request context in the test suite via Arc.container().requestContext().activate(), the tests pass
- However, Quarkus.io as well as engine-cdi support @RequestScoped beans
- BeanManager
- #getELResolver is called which is not supported
- The prototype is currently designed in a way that the default process engine starts automatically and cannot be replaced with a custom process engine
- This is probably a solvable problem
- The @Alternative annotation only seems to work in conjunction with @Priority(1)
- Might also be related to the fact that the engine-cdi module is tested against Weld 1.1 which supports CDI 1.0
- The @Specializes is not supported
- Not used by the engine-cdi module but there is a test for it
- Quarkus.io does not assign a scope implicitly which means that all beans are ignored without a scope
- Added @ApplicationScoped to beans without scope so that the test suite succeeds
- engine-cdi has @Qualifier annotation on @ProcessVariable and @ProcessVariableTyped which leads to auto injections when fields are annotated with these annotations
- Auto injection for fields can be disabled with quarkus.arc.auto-inject-fields=false
- engine-cdi exposed beans have @Dependent scope by default which leads to warning logs
- Obtained instance of @Dependent scoped bean org.camunda.bpm.engine.cdi.CurrentProcessInstance_ProducerMethod_getExecutionId_62b5049703b5a9e9ea537d15ef7a7605df494847_Bean@665d124a outside of process engine command context. Bean instance will not be destroyed. This is likely to create a memory leak. Please use a normal scope like @ApplicationScoped for this bean.
Failing tests by problem
Heads-up: failing tests might hide further problems we cannot oversee right now.
- BeanManager#getELResolver unsupported
- ThreadContextAssociationTest.testBusinessProcessScopedWithJobExecutor
- DmnJuelTest
- BusinessProcessContextTest#testConversationalBeanStoreFlush
- MultiInstanceTest
- ElTest
Technical Requirements
- Testsuite exists which ensures our Quarkus.io extension supports the features up to a certain extent
- Limitation of Scope
- 1) Copy test cases to Quarkus.io extension and make them work
- 2) Preferred way: In engine-cdi module, tests are additionally executed against Quarkus.io environment (we can exclude tests for unsupported behavior)
- Limitation of Scope
- Documentation exists which outlines the limitations
Further investigation necessary
- Have a look at the excluded test cases and refactor them to run under quarkus when possible
- Decide if quarkus.arc.auto-inject-fields=false should be part of the engine extension or not; what is the user impact?
- Evaluate if we can fix the unsupported BeanManager#getELResolver to allow accessing methods on beans from expressions
- Evaluate if the changed behavior of the @Alternative annotation is related to changes in the CDI 2.0 specification
- Evaluate the impact of the following Quarkus.io limitations
- Passivation and passivating scopes are not supported: @BusinessProcessScoped needs to be PassivationCapable
- Portable Extensions are not supported: ProcessEngineExtension uses the portable Extension interface
- Evluate the impact of missing beans.xml configuration capabilities and decide if we need an alternative solution
[1] https://docs.camunda.org/manual/7.15/user-guide/cdi-java-ee-integration/
[2] https://docs.camunda.org/manual/7.15/user-guide/cdi-java-ee-integration/contextual-programming-model/#associate-a-conversation-with-a-process-instance
[3] https://docs.camunda.org/manual/7.15/user-guide/cdi-java-ee-integration/contextual-programming-model/#declaratively-controlling-the-process
[4] https://docs.camunda.org/manual/7.15/user-guide/cdi-java-ee-integration/contextual-programming-model/#work-with-businessprocessscoped-beans
[5] https://docs.camunda.org/manual/7.15/user-guide/cdi-java-ee-integration/built-in-beans/
[6] https://docs.camunda.org/manual/7.15/user-guide/cdi-java-ee-integration/the-cdi-event-bridge/
[7] https://quarkus.io/guides/cdi-reference#supported_features
[8] https://quarkus.io/guides/cdi-reference#limitations
[9] https://docs.jboss.org/cdi/api/2.0/javax/enterprise/context/RequestScoped.html
mgm-controller-panel
This is the controller panel for Smart Panels app
Attachments
Issue Links
- causes
-
CAM-13743 CDI: Investigate and decide if beans.xml needs a replacement
- Closed
-
CAM-13744 CDI: Investigate impact of missing support of Passivation and passivating scopes
- Closed
-
CAM-13745 CDI: Investigate impact of missing Extension API support
- Closed
-
CAM-13746 CDI: Investigate if process engine should be replaceable
- Closed
-
CAM-13747 CDI: Investigate behavior of @Alternative annotation in conjunction with @Priority(1)
- Closed
-
CAM-13748 CDI: Investigate the default configuration of auto-inject-fields
- Closed
-
CAM-13749 CDI: Investigate memory leak log for @Dependent scoped beans
- Closed
-
CAM-13750 CDI: Rewrite currently failing tests
- Closed
-
CAM-13751 CDI: Investigate fix for missing BeanManager#getELResolver support
- Closed
- is depended on by
-
CAM-13631 I can deploy modelling resources
- Closed