@vishucamunda refer the below example:
BPM File: callActivityExample.bpmn (8.0 KB)
<process-application
xmlns="http://www.camunda.org/schema/1.0/ProcessApplication"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<process-archive>
<resource>process.bpmn</resource>
<properties>
<property name="isDeleteUponUndeploy">false</property>
<property name="isScanForProcessDefinitions">true</property>
<property name="javaSerializationFormatEnabled">true</property>
</properties>
</process-archive>
</process-application>
@Slf4j
@Component
public class ObjectDeserializeDelegate implements JavaDelegate {
@Override
public void execute(DelegateExecution execution) throws Exception {
ObjectValue typedObjectOrderValue = execution.getVariableTyped("orderDataJava");
log.info("Type name:{}, SerializationDataFormat:{}", typedObjectOrderValue.getObjectTypeName(),
typedObjectOrderValue.getSerializationDataFormat());
Order deserializedOrder = (Order) typedObjectOrderValue.getValue();
log.info("deserializedOrder:{}", deserializedOrder);
}
}
@Component
public class ObjectSerializeDelegate implements JavaDelegate {
@Override
public void execute(DelegateExecution execution) throws Exception {
Order order = Order.builder().orderId("OR3487").orderName("Laptop").orderPrice(80000.00).orderType("Electronics")
.build();
ObjectValue orderTypedObjectValue = Variables.objectValue(order)
.serializationDataFormat(Variables.SerializationDataFormats.JAVA).create();
execution.setVariable("orderDataJava", orderTypedObjectValue);
}
}
@Getter
@Builder
@ToString
@AllArgsConstructor
public class Order implements Serializable {
private static final long serialVersionUID = 1L;
private final String orderId;
private final String orderType;
private final String orderName;
private final double orderPrice;
}