Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-11410 Camunda Engine Quarkus Extension
  3. CAM-13744

CDI: Investigate impact of missing support of Passivation and passivating scopes

    XMLWordPrintable

Details

    • Sub-task
    • Resolution: Fixed
    • L3 - Default
    • 7.16.0, 7.16.0-alpha4
    • None
    • quarkus
    • None

    Description

      Problem

      • According to the Quarkus documentation [1]:

        Passivation and passivating scopes are not supported

      • The javadocs of @BusinessProcessScoped say:

        Note: BusinessProcessScoped beans need to be PassivationCapable.

        • This implies that the PassivationCapable interface must be implemented.

      Reasoning

      • According to the CDI 1.0 specification [2], passivation is:

        The temporary transfer of the state of an idle object held in memory to some form of secondary storage is called passivation. The transfer of the passivated state back into memory is called activation.

        • A managed bean is passivation capable if and only if the bean class is serializable and all interceptors and decorators of the bean are serializable.

        • A custom implementation of Bean is passivation capable if it implements the interface PassivationCapable.

      • The @BusinessProcessScoped beans defined for the test cases are not PassivationCapable but Serializable and run successfully on both Weld and Quarkus
        • The following exceptions are thrown when Serializable is removed from the bean definitions:
        • Weld:

          WELD-000072 Managed bean declaring a passivating scope must be passivation capable.

        • Quarkus:

          Cannot find serializer for value 'Untyped value 'org.camunda.bpm.engine.cdi.test.impl.beans.CreditCard@26cfa482', isTransient = false'.

      • Our user guide [3] says:

        Instances of BusinessProcessScoped beans are stored as process variables in the current process instance. BusinessProcessScoped beans need to be PassivationCapable (for example Serializable).

      Based on the findings above, a BusinessProcessScoped bean needs to be Serializable so that the engine can store it as a variable. On passivation capable CDI implementations like Weld, the BusinessProcessScoped bean can be transferred from the memory into secondary storage, which Quarkus does not support. Passivation capable CDI implementations like Weld enforce the Serializable or "passivation capable" bean reference requirement already on deployment level by throwing the exception mentioned above while on Quarkus this validation is not performed. Passivation capable support is not a functional requirement but leads to a reduction of memory consumption during the runtime of the application.

      Enforcing passivation capable for the BusinessProcessScoped annotation makes sense since these beans are stored by the engine as variables and therefore persisted in the database. Since CDI validates that the bean itself, as well as the references, can be serialized, the engine can store these objects without any problems.

      Solution

      Let's document that with Quarkus BusinessProcessScoped beans are not validated on deployment for being serializable since PassivationCapable is not supported. However, users can define BusinessProcessScoped beans in Quarkus anyways by ensuring that they are Serializable and by refraining from having a reduced memory consumption.

      [1] https://quarkus.io/guides/cdi-reference#limitations
      [2] https://docs.jboss.org/cdi/spec/1.0/html_single/#passivatingscope
      [3] https://docs.camunda.org/manual/7.15/user-guide/cdi-java-ee-integration/contextual-programming-model/#work-with-businessprocessscoped-beans

      mgm-controller-panel

        This is the controller panel for Smart Panels app

        Attachments

          Issue Links

            Activity

              People

                tassilo.weidner Tassilo Weidner
                tassilo.weidner Tassilo Weidner
                Tassilo Weidner Tassilo Weidner
                Nikola Koevski Nikola Koevski
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Salesforce