JBoss Community

Message Event (throw and catch problem)

created by krishanps in jBPM - View the full discussion
Merry X-Mas, hope you all enjoyed also the holidays.

I have short question, when I use message event to throw and catch it doesn't work, I only get as a output "Sending message: MyValue". If I instead uses signal events in the way that I replace both times the line EventMessage.bpmn2 it works properly.

<messageEventDefinition messageRef="_8_Message"/> with the line <signalEventDefinition signalRef="_8_Message"/>

Can you please tell me what could be the problem and how I can fix it?
Thank you very much

My *.bpmn file:

 

    &lt;!-- Throw a message event &gt;    &lt;intermediateThrowEvent id="_7" name="Script" &gt;      &lt;dataInput id="_7_Input" /&gt;      &lt;dataInputAssociation&gt;            &lt;sourceRef&gt;x&lt;/sourceRef&gt;            &lt;targetRef&gt;_7_Input&lt;/targetRef&gt;      &lt;/dataInputAssociation&gt;      &lt;inputSet&gt;            &lt;dataInputRefs&gt;_7_Input&lt;/dataInputRefs&gt;      &lt;/inputSet&gt;      &lt;messageEventDefinition messageRef="_8_Message"/&gt;    &lt;/intermediateThrowEvent&gt;        &lt;! Catch a message event --&gt;    

 


My *.java file:

      public static final void main(String[] args) {            try {                  // load up the knowledge base                  KnowledgeBase kbase = readKnowledgeBase();                  StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();                  KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");                  ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new DoNothingWorkItemHandler());                  ksession.getWorkItemManager().registerWorkItemHandler("Send Task", new SendTaskHandler());                  Map&lt;String, Object&gt; params = new HashMap&lt;String, Object&gt;();                  params.put("x", "MyValue");                  params.put("y", "OtherValue");                               // start a new process instance                  ksession.startProcess("IntermediateCatchEvent", params);                                    logger.close();            } catch (Throwable t) {                  t.printStackTrace();            }      }      private static KnowledgeBase readKnowledgeBase() throws Exception {            KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();            kbuilder.add(ResourceFactory.newClassPathResource("EventMessage.bpmn2"), ResourceType.BPMN2);            return kbuilder.newKnowledgeBase();      }

 

 

Reply to this message by going to Community

Start a new discussion in jBPM at Community