AnsweredAssumed Answered

Issue with behaviors called several times

Question asked by eric_k on Sep 27, 2016
Latest reply on Oct 3, 2016 by afaust

Hello,

 

I have been tasked to develop a feature that sends mail to specific users when a document has been modified.
Essentially, I use behavior policies and aspects. Aspect 'subscribable' is used.
I register the event-handler like this :

 

policyComponent.bindClassBehaviour(
    NodeServicePolicies.OnUpdateNodePolicy.QNAME,
    QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "subscribable"),
    new JavaBehaviour(this, "onUpdateNode", NotificationFrequency.TRANSACTION_COMMIT));

 

My event-handler is like this :
    public void onUpdateNode(NodeRef docNodeRef) {
    ...
    }


My implementation is very close to what is proposed in :
- Reference manual,
- Jeff Potts' tutorial on behaviors.

 

My issue is : For a simple update (e.g. upload of a new version), the event-handler is called several times.

Why are there several notifications ?

 

I use Alfresco CE 5.0.d.

 

Thanks in advance for your help !

Outcomes