AnsweredAssumed Answered

Behavior Execution onCommit and not beforeCommit

Question asked by xian on Nov 17, 2010
Latest reply on Nov 18, 2010 by xian
Hi
I have a policy that detects node creation and passes the reference to another thread for processing. The problem is that the policies behaviour is executed before the transaction has finished committing and so the worker thread can't 'see' the new node in its transaction if it begins execution soon enough. Is there a way to trigger the policy execution after the commit, or in the policy queue some kind of task for when it finishes comitting?

Some code from the policy class:

   public void init() {
      policyComponent.bindClassBehaviour(
         NodeServicePolicies.OnCreateNodePolicy.QNAME,
         UncModel.TYPE_STATE,
         new JavaBehaviour(
            this,
            "onCreateNode",
            NotificationFrequency.TRANSACTION_COMMIT
         )
      );
   }

and


   public void onCreateNode(ChildAssociationRef car) {
      sender.queueItem(car.getChildRef(), false);
   }

Outcomes