Process started by Start Message

1
0
-1

I Have a Process that is started with a 'Start message' event, works well

My questions are,

The StartedBy returns 0 (Why is not the Id of the user that started the parent Process)

The RootProcessInstance returns the same process Id (Why is not the id of the Parent Process)

The CallerId returns -1 (Why is not the id of the Parent Process)

For example, If I have 2 parent process definition, how to I know Who is the caller? o What is the Process Instance Id that fired the start message event... I have to add parameters to my starter message ?

I am working with Engine API (EJB)

1 answer

1
0
-1

startedBy variable store the id of the user who actually start the process. In your situation the process is not started manually but automatically based on start event who catch the BPMN message. So the process instance is actually created by the Bonita Engine. This explain why the value of startedBy is 0. If you need such information I recommend to pass it in the message content and store it in a business variable attribute.

rootProcessInstance will provide a different id only when the current process instance was created using a call activity. When using a call activity there is a relation of parent / child process between the different process definitions.

callerId is -1 because the process who sent the message is not the parent of the process started. Parent child relation only exist with call activity.

The easiest way to get information about the sender of the message in the receiving process is actually to do as you suggest and carry out this information in the message.
Another option would be to do some introspection in the receiving process using the API to get information on the message but I cannot find an API providing such information.

Notifications