SerializationDataFormats Multi Instance Element Variable

Dear Community,

I need some help with the SerializationDataFormats of a multi instance sub process.

I am initializing a list using:

Variables.objectValue(contacts).serializationDataFormat(SerializationDataFormats.JSON).create();

And then I want to iterate over the contacts in a multi instance sub proces. I define contacts as collection and define “contact” as element variable. I hoped that Camunda would use the same SerializationDataFormat. However, when i inspect the variable in the cockpit, “contact” is not persisted as JSON.

image
image

How can I instruct Camunda to serialize as JSON when using multi instance element variable?

Any hint is appreciated.

Hi @philipp.hehnle

Set the engine’s default serialization to application/json

In Camunda Run or Camunda springboot, below is the property to set:

camunda.bpm.default-serialization-format

1 Like

Is the subprocess contained in the same application as the calling process? What is the serialisation format set to? I assume it’s not JSON, otherwise you wouldn’t need to set it explicitly for the variable.

As to the serialisation “inheritance”: I would not expect it. IMO the element variable should be serialised according to the format set for the engine.

<process-archive>
    <properties>
        <property name="javaSerializationFormatEnabled">true</property>
    </properties>
</process-archive>

Usage Explanation:

The <property name="javaSerializationFormatEnabled">true</property> setting is used to enable Java serialization as a supported format for process variables in Camunda BPM. This allows Java objects to be stored and retrieved from the process engine’s database during process execution.

When to Use:

  • Custom Java Objects as Process Variables:
    • If you need to store complex Java objects (e.g., custom classes) as process variables.
  • Serialization for Inter-Process Communication:
    • When serialized Java objects are required for communication between different processes or systems.
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.