Hi,
I have a simple model bpmn (start message and two tasks ), the problem is that i dont know how to start the flow with a message,
i worked with JMS and now i can get the message and all the data that i need but how i can start the flow with my message ??? what is the secret ?? O.O jajaja
Please i need help
ProcessInstance startProcessInstanceByMessage(String messageName); ProcessInstance startProcessInstanceByMessage(String messageName, Map<String, Object> processVariables); ProcessInstance startProcessInstanceByMessage(String messageName, String businessKey, Map<String, Object> processVariables);
The "String messageName" is my message or the name of my process? or the message property "name" in bpmn diagram?
How i can pass to activiti all the email data?
Thats my problem... sorry if this sounds silly
(Ji My english is bad cause i speak spanish and im practicing o.o )
Thanks for your time
Solved! Go to Solution.
Within the BPMN Process definition you will need to create a message definition in the process model:
This is the message you will use to start the process instance.
Next, you need to add a "Start Message Event" in your process and subscribe to the message you created:
Now, in order to start the instance, you can either use the REST API:
POST /activiti-app/api/runtime-instance
{ "message":"myMessage", "variables": [ { "name":"myVar", "value":"This is a variable", } ] }
Alternatively, if you are using the Java API use:
ProcessInstance startProcessInstanceByMessage("myMessage");
If you are looking for a complete example using java code, take a look at
MessageStartEventTest.java in the Activiti source Activiti/MessageStartEventTest.java at activiti-5.22.0 · Activiti/Activiti · GitHub
Look for "testingSingleMessageStartEvent" test.
Hope this helps,
G
Ara,
Since you've already done the leg-work for creating the JMS integration, the rest is just utilizing Activiti's built-in APIs to call the appropriate methods to kick off a process. The API Docs list several methods similar to the one you highlighted:
startProcessInstanceByMessage(<params>)
Me personally, I like to look at Activiti's Tests in Github to see how these things work; but basically what you're going to end up doing is: Create a named message event in the process diagram, then call it as the 'messageName' parameter you were asking about. The User Guide documentation is a pretty solid reference as to how these work and setting them up.
Within the BPMN Process definition you will need to create a message definition in the process model:
This is the message you will use to start the process instance.
Next, you need to add a "Start Message Event" in your process and subscribe to the message you created:
Now, in order to start the instance, you can either use the REST API:
POST /activiti-app/api/runtime-instance
{ "message":"myMessage", "variables": [ { "name":"myVar", "value":"This is a variable", } ] }
Alternatively, if you are using the Java API use:
ProcessInstance startProcessInstanceByMessage("myMessage");
If you are looking for a complete example using java code, take a look at
MessageStartEventTest.java in the Activiti source Activiti/MessageStartEventTest.java at activiti-5.22.0 · Activiti/Activiti · GitHub
Look for "testingSingleMessageStartEvent" test.
Hope this helps,
G
Thanks!!! you save my life
Great i will try to download the example... Thanks!!!
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.