Not able to pass execution variable if multi instance async is enabled

Hi,

We have a process having call activity marked as sequential multi instance and we are trying to pass a JSON array from the process to the called activity. This process works perfectly fine except in the below scenario:

However, if we try to make the call activity as “Multi instance asynchronous before/after”, the JSON array execution variable is not getting passed to the multi instance call activity due to which we are getting the error as “JSONArray[0] not found”.

Hi @saumyasucharita,

I guess that the serialization of the JSON array does not work correctly, i.e. the roundtrip Java object -> serialized value -> Java object does not result in the original value. You won’t notice this problem if you have no wait states in between variable access, because in that case the Java object is cached. Once you add a wait state (e.g. asynchronous continuation), the problem becomes visible, because the cached value is discarded once the wait state is reached.

I recommend to investigate in this direction. If you can share a unit test reproducing this, I am happy to take a look.

Cheers,
Thorben

Hi Thorben,

Thanks for the reply !!
Will the serialization issue be resolved if we use the Camunda spin dataformat for JSON processing?

Thanks,
Saumya

Hi Thorben,

We tried using the spin api to serialize the JSON array. We are passing the below variable from main process to call activity. But we are not getting this variable in the child process due to which we got Null pointer exception.
SpinJsonNode tktDetails = (SpinJsonNode) execution.getVariable(“changeRecord”);
PrintLog.printLog(this.getClass().getSimpleName(), “Ticket details :” + tktDetails);

Exception in logs:
2018-12-19 16:13:11.714 ERROR 2948 — [io-9095-exec-25] org.camunda.bpm.engine.context : ENGINE-16004 Exception while closing command context: null

java.lang.NullPointerException: null
at com.att.vtm.gammacmsotretirement.workflow.ParseChangeRecordforAssetInfo.execute(ParseChangeRecordforAssetInfo.java:24)
at org.camunda.bpm.engine.impl.bpmn.delegate.JavaDelegateInvocation.invoke(JavaDelegateInvocation.java:36)
at org.camunda.bpm.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:54)
org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocationInContext(DefaultDelegateInterceptor.java:87)
at org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:59)
at org.camunda.bpm.engine.impl.bpmn.behavior.ServiceTaskDelegateExpressionActivityBehavior$3.call(ServiceTaskDelegateExpressionActivityBehavior.java:112)
at org.camunda.bpm.engine.impl.bpmn.behavior.ServiceTaskDelegateExpressionActivityBehavior$3.call(ServiceTaskDelegateExpressionActivityBehavior.java:98)
at org.camunda.bpm.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior.executeWithErrorPropagation(AbstractBpmnActivityBehavior.java:108)

Could you please advise here?