Starting new process instance from another process - messages

Hi guys,
I’m trying to start a new process from another process. I’m using messages.

send_message.bpmn (7.2 KB)
process_with_start_signal_event.bpmn (12.5 KB)

I know how to start a process by sending a message (using REST API), but there is something wrong with throwing a message inside process.

Thanks for any help.

2 Likes

You’re going to need some kind of code to send the message - the message cannot be send without calling the API explicitly.

So you need to add an implementation type to your message event:

3 Likes

@dikey94, here is a easy way get you started:

Use implementation: expression

${execution.getProcessEngineServices().getRuntimeService().createMessageCorrelation("MyMessage").correlateWithResult()}

You can see other options for the Runtime Service:

https://docs.camunda.org/javadoc/camunda-bpm-platform/7.6/org/camunda/bpm/engine/RuntimeService.html

https://docs.camunda.org/javadoc/camunda-bpm-platform/7.6/org/camunda/bpm/engine/RuntimeService.html#correlateMessage(java.lang.String)

3 Likes

Thank you guys for your time. Really appreciate.

I’ve used a signal to start another process but both solutions are good.

Regards!

@dikey94, just FYI if you need to pass variables to the signalled process then take a look at the Message’s input parameters

Good to know. Thanks!

is that possible to share those 2 bpmn files here please, i tried it a lot, doesnt seem to be working. guess im missing something.

Hi @Nishant_Agrawal,

have a look at this example: https://github.com/camunda-consulting/messaging-example

Hope this helps, Ingo

1 Like

Hi @Niall- I assume the call to child process is going to be asynchronous. I have tried a similar implementation where parent process runs a loop to trigger multiple child processes via send message event.
The purpose of using this over call activity was to have multiple instances triggered asynchronously, however each instance of the child process is waiting for completion before the next instances begins.

Any advise would be really helpfull.

Thanks:
Satish

By default it will start them async. to create transaction boundaries for each instance use the asynchronous before tick box on the start event of the process you’re calling.

Thank @Niall, basically I do not want the child process instance to wait for completion before next one triggers. If parent process has triggered 30 send messages via a loop I would like all the 30 instances to be triggered parallely. How can that be achieved?

Yup, what i suggested would achieve that.