Bug 804054

Summary: MessageEndEvent causes an exception
Product: [JBoss] JBoss Enterprise BRMS Platform 5 Reporter: Tomas Schlosser <tschloss>
Component: jBPM 5Assignee: Kris Verlaenen <kverlaen>
Status: NEW --- QA Contact:
Severity: urgent Docs Contact:
Priority: unspecified    
Version: BRMS 5.3.0.GA   
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tomas Schlosser 2012-03-16 12:28:34 UTC
Description of problem:
The exception was quite unclear at the beginning as it said "Could not find exception handler for org.drools.WorkItemHandlerNotFoundException while executing node 3". From the System.err I found out that "Could not find work item handler for Send Task" was the root. The trick is there was no human task nor anything else that would require work item handler. However as I found out later there is a static code in message end event that executes work item.
I expected sending the messages to work the similar way as receiving them - via ksession.signalEvent().
Furthermore the workItem created always has name "Send Task" which causes confusion as I would expect it to have messageRef as a name.

Version-Release number of selected component (if applicable):
BRMS-5.3.0-ER4

How reproducible:
Every time

Steps to Reproduce:
1. start 'BPMN2-MessageEndEvent.bpmn2' process without setting the WorkItem handler
  
Actual results:
java.lang.IllegalArgumentException: Could not find exception handler for org.drools.WorkItemHandlerNotFoundException while executing node 3

Expected results:
More clear exception, ideally none

Additional info: static code in EndNode action generated from EndEventHandler (lines 152-157)

org.drools.process.instance.impl.WorkItemImpl workItem = new org.drools.process.instance.impl.WorkItemImpl();
workItem.setName("Send Task");
workItem.setParameter("MessageType", "java.lang.Object");
((org.drools.process.instance.WorkItemManager) kcontext.getKnowledgeRuntime().getWorkItemManager()).internalExecuteWorkItem(workItem);

Comment 1 Maciej Swiderski 2012-04-18 07:47:50 UTC
Improved exception will be added with following pull request https://github.com/droolsjbpm/jbpm/pull/82

In my opinion work item based solution is required to be able to provide flexible and pluggable way of handling messaging in and out of the engine so users could decide how the message will be transmitted to the destination. And signal is more for communication inside the engine.