- According to the Quarkus documentation :
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.
- According to the CDI 1.0 specification , 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-000072 Managed bean declaring a passivating scope must be passivation capable.
Cannot find serializer for value 'Untyped value 'org.camunda.bpm.engine.cdi.test.impl.beans.CreditCard@26cfa482', isTransient = false'.
- Our user guide  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.
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.