Intermediate Events in Parallel Multi-Instance Subprocess

Hello everyone, I am modeling the process that I attach.

The first service task creates a collection of items, which is then handled in parallel by the subprocess. I am using Node.js to perform all the service-tasks.

“Invia Richiesta” is programmed to send content to an external server, which accepts the request.
Remotely, asynchronously, messages to camunda can be sent referring to an istance of the subprocess. A message can be of two types (ACK or NACK) or nothing can be sent, which means that (after two minutes) the instance of the subprocess terminates.

I followed this documentation for sending messages to camunda using HTTP POST requests here: Deliver a Message | docs.camunda.org
The only thing I modified are that instead of the businessKey, I put the processInstanceId; in correlationKeys I put the user’s identifier, using the same elementVariable as in multi-instance, and in processVariable I put the content that then the next task (in case of “ACK”, “Messaggio Ricevuto”) will have to handle (I assume using variables).

I hope it’s all right so far. By the way, I have two problems:

  • if I don’t put the “all” attribute, the POST of sending the message returns 400 saying that “org.camunda.bpm.engine.MismatchingMessageCorrelationException: Cannot correlate message ‘msgACK’: No process definition or execution matches the parameters”. When I put “all” it returns 204, but despite this, nothing appears in the cockpit camunda (there are the instances that are all stopped Event-based XOR).
  • after two minutes the various instances begin to expire, in the console I print the result of the “Tempo Scaduto” service-task reporting the name of the instance that has exceeded two minutes. Not all instances expire at the same time (the last expired 4 minutes after having been initialized, although I sent them together and in between I sent no messages of any kind. How come?

Thank you so much in advance for your help!
prova.bpmn (13.1 KB)