Bug 761421

Summary: working memory event listener not registered from Spring configuration
Product: [JBoss] JBoss Enterprise BRMS Platform 5 Reporter: Radovan Synek <rsynek>
Component: BRE (Expert, Fusion)Assignee: Nobody <nobody>
Status: VERIFIED --- QA Contact: Radovan Synek <rsynek>
Severity: medium Docs Contact:
Priority: unspecified    
Version: BRMS 5.3.0.GACC: rzhang
Target Milestone: ---   
Target Release: BRMS 5.3.0.GA   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
maven web app none

Description Radovan Synek 2011-12-08 10:08:54 UTC
Created attachment 542456 [details]
maven web app

I have folowing Spring configuration (showing only relevant part):

<bean id="debug-wm-listener" class="org.drools.event.DebugWorkingMemoryEventListener" />       
<drools:ksession id="statefulSession" type="stateful" kbase="kbase1"> 
    <drools:workingMemoryEventListener ref="debug-wm-listener"/>
</drools:ksession>

Configured WM Event listener in knowledge stateful session by Spring. Expecting (at least) one WM Event listener:
statefulSession.getWorkingMemoryEventListeners().size()

but size is 0. 

See attachment:
build as maven project, then deploy to tomcat, open webapp in browser and click on the second link.

Comment 1 Geoffrey De Smet 2012-01-10 18:06:09 UTC
On first sight, looks like KnowledgeSessionDefinitionParser is forgetting to call AbstractKnowledgeSessionBeanFactory.setWorkingMemoryEventListeners(...)

Comment 2 Geoffrey De Smet 2012-01-12 11:34:30 UTC
The problem is that the wrong DebugWorkingMemoryEventListener has been used.
Instead of:
    <bean id="debugWorkingMemoryEventListener" class="org.drools.event.DebugWorkingMemoryEventListener" />
it should be:
    <bean id="debugWorkingMemoryEventListener" class="org.drools.event.rule.DebugWorkingMemoryEventListener" />

I 'll adjust the code so it fails-fast when such wrong configuration happens.