cancel
Showing results for 
Search instead for 
Did you mean: 

User Task with boundary message event

boekhold
Champ in-the-making
Champ in-the-making
Hi,

(see below for process definition, as generated by Activiti Explorer from 5.17)

I have a process with a User Task "Approve", and on that user task I have configured a Boundary Message Event, waiting for an "InterruptMessage". I'm trying to trigger this Boundary Message Event based on Message Name and ProcessInstanceId as follows:

        Execution execution = processEngine.getRuntimeService().createExecutionQuery()
                .processInstanceId(processInstanceId)
                .messageEventSubscriptionName(messageName)
                .singleResult();

        processEngine.getRuntimeService().messageEventReceived(messageName, execution.getId(), vars);

This consistently fails weirdly enough, even though I'm sure I'm using the correct value for processInstanceId.

(1) Is there anything obviously wrong with this approach?
(2) I noticed in the XML version of the BPMN model that cancelActivity="false" and there doesn't seem to be any way from the Modeler to switch it to "true"? The user guide says that "left side" is non-interrupting, "right side" is interrupting, but that doesn't seem to make any difference for me.

Maarten

<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlnsSmiley Surprisedmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsSmiley Surprisedmgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/processdef">
  <message id="InterruptMessage" name="InterruptMessage"></message>
  <process id="FFCBPMDemo" name="FFCBPMDemo" isExecutable="true">
    <startEvent id="start" name="FFCBPM Start" activiti:initiator="initiator"></startEvent>
    <endEvent id="end" name="end"></endEvent>
    <sequenceFlow id="sequenceFlow2" sourceRef="TOFFC" targetRef="end"></sequenceFlow>
    <serviceTask id="TOFFC" name="TOFFC" activiti:delegateExpression="${FFCFlowStarterService}"></serviceTask>
    <scriptTask id="setVars" name="Set FFC Variables" scriptFormat="groovy" activiti:autoStoreVariables="false">
      <script>execution.setVariable("FFCInstance", "BPMDemo")
execution.setVariable("FFCFlowName", "WriteFile")

// Not used, the BPMFlowStarterActivity uses a process
// variable called 'data' (which just happens to be our
// input as well, so effectively we do a 1-to-1 copy)
def payload = '''\
This is a test message from a groovy script
in a ScriptTask'''

execution.setVariable("payload", payload.stripIndent())</script>
    </scriptTask>
    <sequenceFlow id="sid-F3C16836-8B56-4B08-A88A-1D78EB1640B1" sourceRef="setVars" targetRef="TOFFC"></sequenceFlow>
    <userTask id="Approve" name="Approve" activiti:assignee="kermit"></userTask>
    <sequenceFlow id="sid-ACF18CC9-27A2-4CB9-A3DD-87BDAA23BCCA" sourceRef="Approve" targetRef="setVars"></sequenceFlow>
    <sequenceFlow id="sequenceFlow1" sourceRef="start" targetRef="Approve"></sequenceFlow>
    <sequenceFlow id="sid-61BCA3DA-A81C-4239-B32A-B2F52D4104AC" sourceRef="Approve" targetRef="setVars"></sequenceFlow>
    <sequenceFlow id="sid-B9A579B4-E1A7-4744-90C3-3924F15DFEEB" sourceRef="Interrupt" targetRef="setVars"></sequenceFlow>
    <boundaryEvent id="Interrupt" name="Interrupt" attachedToRef="Approve" cancelActivity="false">
      <messageEventDefinition messageRef="InterruptMessage"></messageEventDefinition>
    </boundaryEvent>
  </process>
8 REPLIES 8

boekhold
Champ in-the-making
Champ in-the-making
ps. Seems my copy/paste of the BPMN XML file is screwed up… I'll attach it here.

boekhold
Champ in-the-making
Champ in-the-making
For the first point I mentioned (the lookup for executions that are waiting for a specific message), this seems to be caused by the fact that the Message Name is changed by Activiti Modeler if you export/import the model, there's a namespace added to the message name. Also see http://jira.codehaus.org/browse/ACT-2198.

boekhold
Champ in-the-making
Champ in-the-making
And the second point (cancel activity), this is covered by http://jira.codehaus.org/browse/ACT-2188. There's a similar issue with Boundary Signal Catching events as well, see http://jira.codehaus.org/browse/ACT-2199.

fjosores
Champ in-the-making
Champ in-the-making
I have similar problem. I can't get the activiti cancelled once the boundary message event is fired.

After boundary message event is fired I have two user tasks active, the one that should have been cancelled and the new one.

Please advise on how to set effectively cancelActiviti=true on boundary message event while you find a solution.

trademak
Star Contributor
Star Contributor
We'll look into this and come back and update this post.

Thanks,

trademak
Star Contributor
Star Contributor
I've fixed the message and signal boundary event issue with the cancel activity property. You should be able to set the correct value in the Modeler now and the import should also work.

Best regards,

boekhold
Champ in-the-making
Champ in-the-making
Awesome, all my bugs fixed. Are there any plans already for a 5.18 release?

jbarrez
Star Contributor
Star Contributor
Not yet planned currently, but since the last one was in december it'll be next month or the month after if all goes well.

Of course, you can always build from source too.