kie-workbench/server and EventListener

326 views
Skip to first unread message

Domengie Jean

unread,
Nov 17, 2016, 6:13:01 PM11/17/16
to Drools Usage
Hi,

I am working on a project to monitor the processing of complex data flows.

I use Kie-workbench / server for the management of data objects, rules, decision tables ...
The data to be processed is loaded onto the server either in real time or scheduled,
Depending on the flow, the rules are scheduled, started by the user or executed after the data is loaded (FireAllRules).
I am developing an application which displays the result of the treatments and I would like to be able to refresh automatically the display for each fact has been modified on the server. For this I think use the EventListener fonctionnalities.

I know this is possible with Drools runtime and it seems to me that this is also possible with the use of kie-server after reading the documentation and view some post on the web.

Can you confirm if this is possible? And if so, what are the best practices / steps to follow? And if there are examples on which I can rely to understand how to develop EventListener.

I use kie-workbench / server 6.4.0.Final and Wildfly 9.0.2.

Thank you for your help and sorry for my english.

Maciej Swiderski

unread,
Nov 18, 2016, 10:38:32 AM11/18/16
to drools...@googlegroups.com
You can declare event listeners in kmodule.xml 

Maciej 
--
You received this message because you are subscribed to the Google Groups "Drools Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage...@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/6db23d94-1d34-445d-a8ca-8e1d3be5b9e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Domengie Jean

unread,
Apr 28, 2017, 11:59:07 AM4/28/17
to Drools Usage
Hello,

After long search on the web I understand that to add EventListener on kie-wb / kie-server it is necessary to create:

1. Create a new project (maven type) in its preferred IDE,
2. Develop listeners,
3. Compile this project,
4. Import it as a dependency in the desired project on kie-wb,
5. Update the file kmodule.xml
6. Still under kie-wb build and deploy the project.

On the other hand I found no documentation and / or examples (except in the case of the use of the runtime of drools) for kie-wb/kie-server.

I start in Java as well as with Drools and I do not understand how to create the class or classes to use the Listener.

Can anyone give me the first steps?

Thank you for your help

Domengie Jean

unread,
May 5, 2017, 10:48:35 AM5/5/17
to Drools Usage
Hi,

No help !!!

Following the advice of Maciej, I added the following lines in my file kmodule.xml:

      <listeners>
        <agendaEventListener type="org.kie.api.event.rule.DebugAgendaEventListener"/>
      </listeners>

And now, I found in the log file server, the lines corresponding to the events of the program auditor. Following this result I have a question:
Why the lines are in ERROR (see below) while the rules executed are the right ones and in the right order?

2017-05-05 16:29:48,636 ERROR [stderr] (default task-10) ==>[AgendaGroupPushedEvent: getAgendaGroup()=AgendaGroup 'R1', getKnowledgeRuntime()=KieSession[0]]
2017-05-05 16:29:48,643 ERROR [stderr] (default task-10) ==>[ActivationCreatedEvent: getActivation()=[[ R1-1 -- 10 active=false ] [ [fact 0:0:1706870546:1306428912:0:DEFAULT:NON_TRAIT:org.drools.core.reteoo.InitialFactImpl:org.drools.core.reteoo.InitialFactImpl@4dde85f0] ] ], getKnowledgeRuntime()=KieSession[0]]
2017-05-05 16:29:48,652 ERROR [stderr] (default task-10) ==>[BeforeActivationFiredEvent: getActivation()=[[ R1-1 -- 10 active=false ] [ [fact 0:0:1706870546:1306428912:0:DEFAULT:NON_TRAIT:org.drools.core.reteoo.InitialFactImpl:org.drools.core.reteoo.InitialFactImpl@4dde85f0] ] ], getKnowledgeRuntime()=KieSession[0]]
2017-05-05 16:29:48,671 INFO [stdout] (default task-10) R1-1 : Agenda R1, Salience 100
2017-05-05 16:29:48,675 ERROR [stderr] (default task-10) ==>[AfterActivationFiredEvent: getActivation()=[[ R1-1 -- 10 active=false ] [ [fact 0:0:1706870546:1306428912:0:DEFAULT:NON_TRAIT:org.drools.core.reteoo.InitialFactImpl:org.drools.core.reteoo.InitialFactImpl@4dde85f0] ] ], getKnowledgeRuntime()=KieSession[0]]
2017-05-05 16:29:48,685 ERROR [stderr] (default task-10) ==>[ActivationCreatedEvent: getActivation()=[[ R1-2 -- 100 active=false ] [ [fact 0:0:1706870546:1306428912:0:DEFAULT:NON_TRAIT:org.drools.core.reteoo.InitialFactImpl:org.drools.core.reteoo.InitialFactImpl@4dde85f0] ] ], getKnowledgeRuntime()=KieSession[0]]
2017-05-05 16:29:48,702 ERROR [stderr] (default task-10) ==>[BeforeActivationFiredEvent: getActivation()=[[ R1-2 -- 100 active=false ] [ [fact 0:0:1706870546:1306428912:0:DEFAULT:NON_TRAIT:org.drools.core.reteoo.InitialFactImpl:org.drools.core.reteoo.InitialFactImpl@4dde85f0] ] ], getKnowledgeRuntime()=KieSession[0]]
2017-05-05 16:29:48,720 INFO [stdout] (default task-10) R1-2 : Agenda R1, Salience 10
2017-05-05 16:29:48,727 ERROR [stderr] (default task-10) ==>[AfterActivationFiredEvent: getActivation()=[[ R1-2 -- 100 active=false ] [ [fact 0:0:1706870546:1306428912:0:DEFAULT:NON_TRAIT:org.drools.core.reteoo.InitialFactImpl:org.drools.core.reteoo.InitialFactImpl@4dde85f0] ] ], getKnowledgeRuntime()=KieSession[0]]
2017-05-05 16:29:48,735 ERROR [stderr] (default task-10) ==>[AgendaGroupPoppedEvent: getAgendaGroup()=AgendaGroup 'R1', getKnowledgeRuntime()=KieSession[0]]
2017-05-05 16:29:48,748 ERROR [stderr] (default task-10) ==>[ActivationCreatedEvent: getActivation()=[[ R3 active=false ] [ [fact 0:0:1706870546:1306428912:0:DEFAULT:NON_TRAIT:org.drools.core.reteoo.InitialFactImpl:org.drools.core.reteoo.InitialFactImpl@4dde85f0] ] ], getKnowledgeRuntime()=KieSession[0]]
2017-05-05 16:29:48,759 ERROR [stderr] (default task-10) ==>[BeforeActivationFiredEvent: getActivation()=[[ R3 active=false ] [ [fact 0:0:1706870546:1306428912:0:DEFAULT:NON_TRAIT:org.drools.core.reteoo.InitialFactImpl:org.drools.core.reteoo.InitialFactImpl@4dde85f0] ] ], getKnowledgeRuntime()=KieSession[0]]
2017-05-05 16:29:48,771 INFO [stdout] (default task-10) R3 : sans agenda, sans salience
2017-05-05 16:29:48,778 ERROR [stderr] (default task-10) ==>[AfterActivationFiredEvent: getActivation()=[[ R3 active=false ] [ [fact 0:0:1706870546:1306428912:0:DEFAULT:NON_TRAIT:org.drools.core.reteoo.InitialFactImpl:org.drools.core.reteoo.InitialFactImpl@4dde85f0] ] ], getKnowledgeRuntime()=KieSession[0]]

Thank for your answers and good week-end
Reply all
Reply to author
Forward
0 new messages