Message Start-Event creates multiple process instances

Hey :slight_smile:

I have the following process:

The subprocess “Antrag auf Vollständigkeit, Konformität prüfen” is triggered by a message in the previous activity. If the subprocess starts instead of one, I have two process instances:

Any suggestions why that happens and how I can fix that?

Thank you very much for your help!

Best wishes,
Matthias

please upload the models.

Thanks for your reply Niall. Attached you can find the process models.

process.bpmn (11.3 KB) Pruefen_Vollstaendigkeit.bpmn (13.9 KB) Pruefen_Antrag.bpmn (5.8 KB) Unterlagen_pruefen.bpmn (6.2 KB)

The models you uploaded don’t match the ones in the screen shots. Can you upload the latest versions.
Can you also explain how you trigger the message event. Showing the code would be useful.

There was a failure in creating the maven file. Somehow I created two .war-Files and both .war files contained different processes. The attached processes are the right on even they are not the same as the ones in my first post:

Pruefen_Vollstaendigkeit.bpmn (16.9 KB) Pruefen_Antrag.bpmn (8.6 KB) Pruefen_Antrag_Dekan.bpmn (9.2 KB) process.bpmn (11.9 KB)

The message in the activity “Unterlagen an Personal und Organisation weiterleiten” is triggered by this code:

public class UnterlagenAnPersonalOrganisationWeiterleiten implements JavaDelegate {

@Override
public void execute(DelegateExecution execution) throws Exception {
	String buskey = (String) execution.getBusinessKey();
	String unterlagen = (String)execution.getVariable("Unterlagen");
	
	execution.getProcessEngineServices().getRuntimeService()
	.createMessageCorrelation("UnterlagenWeitergeleitet")
	.processInstanceBusinessKey(buskey)
	.setVariable("Unterlagen", unterlagen)
	.correlateExclusively();
	


}

}

Right, so it appears you’re both sending a message to start the sub process AND starting it via a sequence flow. That’s why you’re getting two instances. I took your example and substituted ‘do nothing’ code (just logged to sysout) in Unterlagen… and it started only one instance. The other option is to use your code but have that branch of the process end. Another option would be to have a sequence flow from Bearbeitung to the sub process and not throw the message.

Joe

2 Likes

1 Like

1 Like

Thank you very much! We created a new modell in which every process has his own lane. So now, we can really use the message flows.