Bonita Engine Events

1
0
-1

I want to intercept all events of my Processes

1) When a user is assigned I want to send a email to him (I don't want to put the rule in the Process),
2) If the process has activities without user assigned, then I want to assign that to a default user (Manager)

1 answer

1
0
-1
This one is the BEST answer!

I found this, https://documentation.bonitasoft.com/bonita/7.8/event-handlers

I think that this resolves my question.

UPDATE,

Following the instruction I can't register my event Listener... I do the following instruction, and think that I did

I add a property to my EventHandlerExample class

private EventService eventService;

public void setEventService(EventService eventService) {
if (eventService != null){
try {
eventService.addHandler("ACTIVITYINSTANCE_CREATED",this);
eventService.addHandler("JOB_COMPLETED",this);
eventService.addHandler("PROCESSINSTANCE_CREATED",this);
eventService.addHandler("PROCESSINSTANCE_STATE_UPDATED",this);
} catch (HandlerRegistrationException e) {
e.printStackTrace();
}
}
this.eventService = eventService;

} Then, I registered the property in the bonita-tenant-sp-custom.xml


To deploy the FILE, I executed

setup/setup.sh pull (to get the current configuration)

after, I copied new my file bonita-tenant-sp-custom.xml into setup/platform_conf/current/tenants/1/tenant_engine/ folder

before I started again my bonita server, I run** setup/setup.sh push** (to deploy my xml file)

DONT FORGET to copy the JAR (with the listener) into server/webapps/bonita/WEB-INF/lib/ folder

Comments

Submitted by antoine.mottier on Mon, 03/25/2019 - 19:39

Yes I can confirm that if this is a rule that you want to apply to all deployed process definitions you should use an event handler.

Note that if you are using actor filters a task without any candidates will be in failed state. If you are using actor if I remember correctly you will not be able to enable the process if the actor is not mapped to at least one group or role or membership or user. If you want to learn more about users/actors/actor filters you can read the blog post I recently published.

Submitted by julio.rey_1395310 on Tue, 03/26/2019 - 21:24

Thanks Antoine, I need some help.. I can edit some xml using pull and push, but I don't found the bonita-tenant-sp-custom.xml config file after I pull the config, Can I create from scratch? but on the post I not found where I have to put it. I am seeing that after the pull, the current config has a Tenant ID Folder (1) That is a default tenant? or an Additional?

Submitted by julio.rey_1395310 on Thu, 03/28/2019 - 14:38

I added a file bonita-tenant-sp-custom.xml after pull at
setup/platform_conf/current/tenants/1/tenant_engine/bonita-tenant-sp-custom.xml, then I run /setup.sh push. Then when Bonita is started I can see that the Bean (FailedTaskHandler) is instantiate (show a Bean create console message), I registered like the example the event "PROCESSINSTANCE_CREATED", but when I start a new Process Instance, I can't see nothing... y put a line System.out.println ('Hello! from Event Listener').. has somebody an Idea? Thanks

Submitted by antoine.mottier on Mon, 04/01/2019 - 16:27

I'm not sure but I guess that text print on standard output (i.e. System.out) is redirect to nowhere. I recommend for testing to create a logger named org.bonitasoft, log message with the highest log level and check the bonita log file to see if message is there.

Here is an example:

import java.util.logging.Logger;

Logger myLogger = Logger.getLogger("org.bonitasoft.com");

myLogger.severe("Test message");

Also I forgot to mention that adding event handler is a feature only available in Bonita Enterprise Edition as mention at the top of the documentation page.

Notifications