WorkingMemoryEventListener does not seem to receive a retracted notification in JBoss BRMS 5

Solution Verified - Updated -

Environment

  • Red Hat JBoss Business Rule Management System (BRMS) 5

Issue

The WorkingMemoryEventListener collects facts when they are inserted, update or retracted in ksession. The DRL file declares two types of facts as events with expiry timeouts:

declare HelloFact
    @role(event)
    @expires( 2h0m )
end

declare GoodbyeFact
    @role(event)
    @expires( 2h0m )
end

However, upon expiry the WorkingMemoryEventListener does not seem to receive a retracted notification. Is this the expected behaviour?

Resolution

This is not the expected behavior. The DroolsTest2.java class attached to this article shows a simple test using an fact as event with @expires. Also, only for tests purposes, the pseudo clock has been used to call the advanceTime method, so that it can advance the time and the event can expire faster. If line 74 is commented out, retract message will not be displayed anymore.

Attachments

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.