Description of problem: Our customer builds a project where he wants to decorate WorkItemHandlers with SignallingTaskHandlerDecorator AND also wants to use runtime listeners for logging purposes. It is NOT possible to deploy DECORATED WorkItemHandlers AND the runtime listeners. If the WorkItemHandlers are not decorated the WorkItemHandlers work and the listeners do also. I have attached a simple example for testing. It contains a jar file with work item and event listeners for including in the installation. Moreover, you can find the work item definition file and kmodule.xml file. I hope that it is useful. Version-Release number of selected component (if applicable): BPM Suite 6.0.3 How reproducible: Always. If you include some listener in kmodule.xml file then deploying the project will be impossible. If you don't include listeners then deploying will work. Steps to Reproduce: 1. Copy myworkitem-0.0.1-SNAPSHOT.jar file to: <DEPLOYMENTS>/business-central/WEB-INF/lib 2. Start BPMS 6.0.3 3. Create a project in business-central: - Authoring -> Project Authoring - New Item -> Project 4. Create a work item definition from workitemdefinition.wid file included in the zip file attached: - New Item -> Work Item Definition 5. Modify kmodule.xml of the project in business-central: - Authoring -> Administration - Modify the file: <PROJECT>/src/main/resources/META-INF/kmodule.xml - Save 6. Open the project: - Authoring -> Project Authoring - Tools -> Project Editor 7. Build & Deploy Actual results: * If there are not listeners in the kmodule.xml => Build & Deploy -> OK * If there is an <agendalistener> listener in the kmodule.xml => Build & Deploy -> ERROR -> server1.log file included in the zip file attached * If there is an <ruleRuntimeEventListener> listener in the kmodule.xml => Build & Deploy -> ERROR -> server2.log file included in the zip file attached Expected results: Build & Deploy successful for all the cases. Additional info:
Created attachment 1003315 [details] Some files for reproducing the error myworkitem -> maven project with work itemand event listeners kmodule.xml -> workdefinitions.wid -> server1.log -> first error server2.log -> second error myworkitem-0.0.1-SNAPSHOT.jar -> myworkitem compiled
Oscar, according to my tests this seems to be working ok as long as you keep same way of initializing listeners and work item handlers, this means you either use: - mvel expressions - FQCN As you need to pass arguments to work item handler you must stick to mvel expression so following kmodule.xml works just fine: <kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <kbase name="defaultKieBase" default="true" eventProcessingMode="cloud" equalsBehavior="identity" packages="*"> <ksession name="defaultKieSession" type="stateful" default="true" clockType="realtime"> <workItemHandlers> <workItemHandler type="new org.jbpm.bpmn2.handler.SignallingTaskHandlerDecorator(new org.jbpm.workitem.NotificationWorkItemHandler().getClass(), 'Error-abort')" name="Notification"/> </workItemHandlers> <listeners> <agendaEventListener type="new org.jbpm.listener.TrackingAgendaEventListener()"/> </listeners> </ksession> </kbase> </kmodule> do you mind confirming (or denying) that?
Hi Maciej, I confirm that it works. But I have two questions about: 1. According to the documentation (https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_BPM_Suite/6.0/html/Development_Guide/sect-Building_with_Maven.html in the "Example 5.4. A sample kmodule.xml file") we can use the next expression: <agendaEventListener type="org.domain.SecondAgendaListener"/> Then, is it an error in the documentation? 2. Regarding the second error with <ruleRuntimeEventListener> listener, it still happens. In the above example, you can see <ruleRuntimeEventListener>, but it cannot be added through the business-central. You can only add the next listeners types: - Authoring -> Project Authoring - Tools -> Project Editor - Knowledge Base Settings -> Knowledge bases and sessions - Knowledge Sessions -> edit "defaultKieSession" - Listeners: * Working memory event listener * Agenda event listener * Process event listener Then, is it another error in the documentation? Can't we add a "Rule Runtime event listener" in BPMS 6.0.3? Thanks in advance. Regards, Oscar.
(In reply to Oscar Molina from comment #4) > Hi Maciej, > > I confirm that it works. But I have two questions about: > > 1. According to the documentation > (https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_BPM_Suite/6.0/ > html/Development_Guide/sect-Building_with_Maven.html in the "Example 5.4. A > sample kmodule.xml file") we can use the next expression: > > <agendaEventListener type="org.domain.SecondAgendaListener"/> > > Then, is it an error in the documentation? actually you can use both forms but not combined in same kmodule.xml as they work on fallback approach. first mvel based expressions are evaluated (for both listeners and handlers) and in case of failure they fullback to simple reflection based. So as long as you stick to the same way for all items you're good > > 2. Regarding the second error with <ruleRuntimeEventListener> listener, it > still happens. In the above example, you can see <ruleRuntimeEventListener>, > but it cannot be added through the business-central. You can only add the > next listeners types: > > - Authoring -> Project Authoring > - Tools -> Project Editor > - Knowledge Base Settings -> Knowledge bases and sessions > - Knowledge Sessions -> edit "defaultKieSession" > - Listeners: > * Working memory event listener > * Agenda event listener > * Process event listener > > Then, is it another error in the documentation? Can't we add a "Rule Runtime > event listener" in BPMS 6.0.3? I reproduced this one, it looks like some sort of xsd issue as the actual error comes from schema validation saying there is no such element ruleRuntimeEventListener I'll try to investigate it more... keep you updated > > Thanks in advance. > > Regards, > Oscar.
the issue I reproduced was caused by workbench that generates invalid kmodule.xml that was caused by outdates ListenerModel definition that was not updated when workingMemoryListener has been changed to ruleRuntimeMemoryListener kie-wb-common master: https://github.com/droolsjbpm/kie-wb-common/commit/798fd482fbe571bd46dcb58f4022f8a1bdbca647 with this and the rules defined in comment 3 and 5 I was able to use both listeners and handlers registered via kmodule.xml
Hi Maciej, Thanks for your work. Regarding the error with <ruleRuntimeEventListener> listener, I understand that it is solved with your latest changes in ListenersPanelViewImpl.java, ProjectEditorConstants.properties and ListenerModel.java. So we will be able to add it through business-central. Moreover the second error, which we can see in server2.log file, won't happen anymore, right? Finally, will be included in the next release BPMS 6.1.0? How can we provide this solution to the customer? Thanks in advance. Regards, Oscar.
(In reply to Oscar Molina from comment #7) > Hi Maciej, > > Thanks for your work. > > Regarding the error with <ruleRuntimeEventListener> listener, I understand > that it is solved with your latest changes in ListenersPanelViewImpl.java, > ProjectEditorConstants.properties and ListenerModel.java. So we will be able > to add it through business-central. Moreover the second error, which we can > see in server2.log file, won't happen anymore, right? correct, I was able to use both types of listeners defined via business central project editor > > Finally, will be included in the next release BPMS 6.1.0? How can we provide > this solution to the customer? according to flags set it won't be part of 6.1 as it was not marked as blocker > > Thanks in advance. > > Regards, > Oscar.
Hi Maciej, Finally, the rules defined in comment 3 and 5 were enough for the customer. They can continue with their development and they have closed the case. The fix commented in comment 6 is not prioritary for them. So we can downgrade the priority and severity for this BZ. Thanks for your efforts and dedication. You're great. Regards, Oscar.
Verified on 6.2.0. ER1. I was able to add both rule and agenda event listeners in way Maciej described in Comment 3.