krishanps [
http://community.jboss.org/people/krishanps] created the discussion
"Message Event (throw and catch problem)"
To view the discussion, visit:
http://community.jboss.org/message/643239#643239
--------------------------------------------------------------
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:
<!-- Throw a message event --> <intermediateThrowEvent
id="_7" name="Script" > <dataInput
id="_7_Input" /> <dataInputAssociation>
<sourceRef>x</sourceRef>
<targetRef>_7_Input</targetRef>
</dataInputAssociation> <inputSet>
<dataInputRefs>_7_Input</dataInputRefs>
</inputSet> <messageEventDefinition
messageRef="_8_Message"/> </intermediateThrowEvent>
<!-- Catch a message event -->
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<String, Object> params = new
HashMap<String, Object>(); 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(); }
If I instead replace the both times the line
<messageEventDefinition messageRef="_8_Message"/>
with the line <signalEventDefinition signalRef="_8_Message"/>
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/643239#643239]
Start a new discussion in jBPM at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]