cancel
Showing results for 
Search instead for 
Did you mean: 

startProcessInstanceByMessage

alistair
Champ in-the-making
Champ in-the-making
Hi,

I'm trying to utilise a model containing a none start event and a message start event, which has a different entry point into the flow.

In my unit test I'm therefore utilising the startProcessInstanceByMessage method on the runtime service and using the message name as defined against the process.  However this results in an Activiti Exception: "Cannot start process instance by message: no subscription to message with name 'sessionResumptionMessage' found.".

I've compared my test with those packaged in the engine project and can't really see any obvious differences.  Is there any restriction on using both a none start and message start event in the same model?

Here is a code snippet from the unit test:

   @Test
   @Deployment(resources =
   { "diagrams/NewSymptomSelection.bpmn" })
   /**
    * Symptom selection business process - Tests found test.
    */
   public void testSymptomSelectionFlowTestsFound()
   {

      {

         Map<String, Object> variables = new HashMap<String, Object>();
         variables.put("workflowEvent", "symptomSelection");

         ProcessInstance pi = runtimeService.startProcessInstanceByMessage("sessionResumptionMessage", variables);
If anyone can point me in the right direction then I'd be very grateful.

Many thanks

Ali
8 REPLIES 8

jbarrez
Star Contributor
Star Contributor
How does your bpmn xml looks like regarding this start event?

monika_b
Champ in-the-making
Champ in-the-making
Below is my flow diagram. plz help.

Also can someone help how to post flow diagram in this forum?
This diagram I copied in MS word and saved as text file might not be useful.

Thanks in advance for help.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

The links you posted do not work for me. But you can have a look on following test in the git repository to see how signal start event works. Following example is not exactly the same, but maybe it can help.
org.activiti.engine.test.bpmn.event.message.MessageStartEventTest#testMessageStartEventAndNoneStartEvent

https://github.com/Activiti/Activiti/blob/fd1e6259142d8050f5ab3c7d81b33e303b1b85ef/modules/activiti-...

Martin

monika_b
Champ in-the-making
Champ in-the-making
I have exactly same issue. Trying to start a process with messageStartEvent.  This is how I am trigering the flow in my main method:

public static void main(String[] args)
{ repositoryService.createDeployment().addClasspathResource("diagrams/messageProcess.bpmn20.xml").deploy();
  Map<String, Object> processVariables1 = new HashMap<String, Object>();
  processVariables1.put("newCustomerId","Ram");
   ProcessInstance processInstance = runtimeService.startProcessInstanceByMessage("newCustomerRequest", processVariables1);
}


I am getting exception:  Cannot start process instance by message: no subscription to message with name 'newCustomerRequest' found

monika_b
Champ in-the-making
Champ in-the-making
I think I got my answer.
From user Guide:
<b>Message start events are only supported on top-level processes. Message start events are not supported on embedded sub processes.</b>

My usecase is: to halt at a wait state that should get triggered from outside (without user task) and continue the flow.
Any suggestion (please elaborate simple things also, m new to activiti) would be highly appreciated and very helpful.
Also, plz tell me how to upload my workflow images (without using google site if possible) on this forum.

Any suggestion (please elaborate simple things also, m new to activiti) would be highly appreciated and very helpful.

May be this test can help you:
org.activiti.engine.test.bpmn.event.signal.SignalEventTest#testSignalCatchIntermediateAsynch

Also, plz tell me how to upload my workflow images (without using google site if possible) on this forum.
I use references… .

monika_b
Champ in-the-making
Champ in-the-making
Thanks Martin. Had gone through the repository code.  I am now able to resolve my earlier issue now.

But still i am facing issue in my new implementation.  Here I am having 'message start event inside a subprocess' thats gets triggered outside by java service task using 'runtimeService.startProcessInstanceByMessage("waitMessage");'

Please help me why I am getting exception as <b>"Exception in thread "main" org.activiti.engine.ActivitiException: Cannot start process instance by message: no subscription to message with name 'waitMessage' found.". </b>

Many thanks for any help.. 

monika_b
Champ in-the-making
Champ in-the-making
Thanks Martin.