bpmn - Query process instances based on starting message name -


env: camunda 7.4, bpmn 2.0

given process, can started multiple start message events.

  1. is possible query process instances started specific messages identified message name?
  2. if yes, how?
  3. if no, why?
  4. if not @ moment, when?

some apis incidentmessages?

that no out-of-the-box feature should easy build using process variables.

the basic steps are:

1. implement execution listener sets message name variable:

public class messagestarteventlistener implements executionlistener {    public void notify(delegateexecution execution) throws exception {     execution.setvariable("startmessage", "messagename");   } } 

note via delegateexecution#getbpmnmodelelementinstance can access bpmn element listener attached to, determine message name dynamically.

2. declare execution listener @ message start events:

<process id="executionlistenersprocess">   <startevent id="thestart">     <extensionelements>       <camunda:executionlistener           event="start" class="org.camunda.bpm.examples.bpmn.executionlistener.messagestarteventlistener" />     </extensionelements>     <messageeventdefinition ... />   </startevent>    ... </process> 

note bpmn parse listener, can add such listener programmatically every message start event in every process definition. see this example.

3. make process instance query filtering variable

runtimeservice runtimeservice = processengine.getruntimeservice(); list<processinstance> matchinginstances = runtimeservice   .createprocessinstancequery()   .variablevalueequals("startmessage", "messagename")   .list(); 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -