Hello,
Following the example given here :
I want to write an event handler.
I’m not aware of Spring mecanics which I’m starting to learn thanks to bonita (thank you bonita).
It seems my attempt is not working. I’ve added the following in my cfg.xml bean configuration file:
I’ve added a jar containing fr.univlille2.bpm.ActivityNotifier.class in Tomcat’s lib folder and here is the relevant part of my source code (where sendmail() method has been tested)
public class ActivityNotifier implements SHandler {
public ActivityNotifier() {
}
@Override
public void execute(SEvent event) throws SHandlerExecutionException {
sendMail();
}
@Override
public String getIdentifier() {
return null;
}
@Override
public boolean isInterested(SEvent event) {
Object eventObject = event.getObject();
if (!(eventObject instanceof SFlowNodeInstance))
return false;
return true;
}
What’s wrong here ? Do I need to declare ActivityNotifier as a bean too ? When I try to do this bonita gets stuck on a 500 error…
Thanks!
Bonjour aCordier,
Petite question au prélable, utilisez-vous la version community ou la version souscription ? et quelle 6.x ?
Je demande cela, car les Events Handlers sont uniquement configurables dans l’édition Souscription de Bonita BPM.
A ce sujet, je vous invite à découvrir l’exemple disponible dans notre documentation :
http://documentation.bonitasoft.com/event-handlers
Cordialement,
A très bientôt
The method getIdentifier of your custom Handler must not return null but a value which should be unique. This identifier is used internally by the event service.
Bonjour,
J’utilise la version SP mais quand je suis la documentation je ne parviens pas à ce résultat.
Bonjour,
Comme vous utilisez la version SP, je vous invite à ouvrir un nouveau “case” depuis le portail client :
https://customer.bonitasoft.com
N’oubliez pas d’ajouter le log de Bonita que vous trouverez dans le répertoire:
Tomcat_6.2.6\logs\bonita.2014-MM-DD.log
Je suis également tombé sur une page 500 avec ma version 6.2.6 en utilisant l’exemple du site document.
PS/ Normalement, le fichier jar est à mettre dans le répertoire de la webapp de bonita.war :
bonita/WEB-INF/lib
Pourriez-vous faire un dernier test de vérification avant d’ouvrir le case au support Bonita ? Merci par avance.
A bientôt,
LL
Pour le lib ça revient au même non ? Quoi qu’il en soit je vais faire le test et ouvrir le cas, merci.
Antoine
Thanks, just to make it clear to me: this id has to be unique per definition and returning canonical class name may be a good practice, is it ?
Anyway, my big mistake here was to add my fragment to cfg.xml instead of cfg-bonita-events-api-impl.xml
Resolved by this answer as this is the most valuable information given here
According to the javadoc of the method, the identifier must be unique for each instance of the handler. So you can concatenate the className or the concept of that handler with a random number. I am not aware enough about that method.
I fixed the configuration file name in doc page. More updates to this page are coming soon, so keep the feedback coming, please!
Ok for now I bet on a new UID().toString() as a return for the getIdentifier() method more to come