AnsweredAssumed Answered

Query for boundary message event does not work

Question asked by kiyer on May 30, 2013
Latest reply on Jun 10, 2013 by frederikheremans1
Hi,
I am using activiti currently in the test setup to get acquainted. The out of the box config has been set to the H2 in memory database.
I have created a message boundary event for one of my subprocesses. In BPMN it is defined as:

<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://activiti.org/bpmn20">
  …
  <message id="cancelRenewal" name="cancelRenewal"></message>
  <process id="signupWorkflow" name="Sugarsync Signup Process" isExecutable="true">

     <boundaryEvent id="boundarymessage1" name="Message" attachedToRef="subprocess1" cancelActivity="true">
        <messageEventDefinition messageRef="cancelRenewal"></messageEventDefinition>
      </boundaryEvent>
  </process>
</definitions>
I have plugged in a java service task where i wish to send a message to cancel this process:
[java]
RuntimeService runtimeService = execution.getEngineServices().getRuntimeService();
String executionId = runtimeService.createExecutionQuery().messageEventSubscriptionName("cancelRenewal").singleResult().getId();
[/java]
Unfortunately I get a nullpointerException because
[java]
runtimeService.createExecutionQuery().messageEventSubscriptionName("cancelRenewal").singleResult()
[/java] returns null.
Any idea if I am doing something wrong here? or is it a bug?

Thanks!
kiyer

Outcomes