04-24-2017 06:31 PM
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
04-25-2017 05:25 PM
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
04-25-2017 04:53 PM
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.
04-26-2017 09:15 AM
Great i will try to download the example... Thanks!!!
04-25-2017 05:25 PM
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
04-26-2017 09:14 AM
Thanks!!! you save my life
Explore our Alfresco products with the links below. Use labels to filter content by product module.