3 Replies Latest reply: Apr 30, 2013 11:05 AM by Jonathan Fuerth RSS

Trouble With CDI Events

Charles Odili Novice

I have setup CDI eventing within my project but its not working. when an entity is created, the server fires an event thus:

 

@ApplicationScoped @Service

public class RpcCloud implements RpcCloudService {

...

 

     @Inject

          private Event<ProgrammesEdited> editPrgEvt; // CDI event

 

     @Inject @Update

          private Event<OffersUpdated> offersUpdatedEvt; // qualified CDI event

 

     ....

     public boolean saveProgrammes(List<Programme> prgs){

          ArrayList<Programme> managed = new ArrayList<Programme>();

          ...

          editPrgEvt.fire(new ProgrammesEdited(managed)); // fired CDI event

     }

 

     ...

      public boolean saveProgrammeOffer(ProgrammeOffer offer) {

          ....

           offersUpdatedEvt.fire(new OffersUpdated(offer));

     }

}

 

 

And these events are supposed to be picked up from the client(s) thus :

 

@ApplicationScoped

public class ProgrammePresenter implements Presenter{

       ....

       // CDI observers

       public void onProgrammesEdited(@Observes ProgrammesEdited evt){

          GWT.log("progs onProgrammesEdited");

       }

 

       public void onOffersUpdated(@Observes @Update OffersUpdated evt){

          GWT.log("progs onOfferUpdated");

       }

 

}

 

 

However, I do not see the GWT log messages in dev mode, implying that the events are not picked up in the client even though I confirmed that the call/invocation/fireing code on the server "executes"