Hi there,
I am trying to send a bigger variable to main process and I know the limit for String is 4000 chars.
I’ve created an objectValue from my JAVA object.
I’m getting this error:
org.camunda.bpm.engine.context : ENGINE-16004 Exception while closing command context: java.util.LinkedHashMap cannot be cast to java.lang.String
java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to java.lang.String
I have a java List object and I’m trying to convert it to ObjectValue in order to send it as a variable to the process.
The variable jsonSerializable cannot be sent as I am receiving the above error.
My code:
@Override
public void execute(DelegateExecution execution) throws Exception {
Blob variable = (Blob) execution.getVariable(CamundaVariable.EXTRACTED_INFORMATION.getValue());
List<InformationResponseDto> allegroProductOffering = helper.deserializeAllegroProductOffering(variable);
ObjectValue jsonSerializable = Variables
.objectValue(allegroProductOffering)
.serializationDataFormat(Variables.SerializationDataFormats.JSON)
.create();
RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService();
String parentProcessId = (String) runtimeService
.getVariable(execution.getProcessInstanceId(), "parentProcessInstanceId");
String currentProcessName = (String) runtimeService
.getVariable(execution.getProcessInstanceId(), "processName");
BaseEventMessage baseEventMessage = new BaseEventMessage();
baseEventMessage.setMessageType(MessageType.CHILD_PROCESS_COMPLETE_EVENT);
baseEventMessage.setChildProcessInstanceId(execution.getProcessInstanceId());
baseEventMessage.setParentProcessInstanceId(parentProcessId);
baseEventMessage.setPayload(setupDataForMainEngine(currentProcessName, jsonSerializable));
producerApi.produceFinishEventMessage(baseEventMessage);
}
private HashMap<String, Object> setupDataForMainEngine(String currentProcessName, Object allegroProductOffering) {
HashMap<String, Object> activeHandlerData = new HashMap<>();
activeHandlerData.put(currentProcessName, allegroProductOffering);
return activeHandlerData;
}
Any suggestions on how to solve this?