6 Replies Latest reply on Nov 27, 2009 11:24 AM by Jean-Élie Le Corre

    Display an StatusMessage from an Asynchronous method ?

    Jean-Élie Le Corre Newbie

      Hello,


      I am having a problem trying to display a status message from an Asynchronous method.
      The method is called from a button :


      part of page.xhtml :


      <h:messages globalOnly="true" styleClass="message" infoClass="messageInfo" errorClass="messageError" id="globalMessages"/>
      <s:button  value="Message asynchronous" action="#{sourceFileManager.messageAsynchronous}" />



      part of ISource.java :


      @Local
      public interface ISourceFileManager {
          @Asynchronous
          void messageAsynchronous(); 
      }



      part of Source.java :


      @Name("source")
      @Stateless
      public class Source implements ISource {
          @In private StatusMessages statusMessages;
      
          public void messageAsynchronous() {
              this.statusMessages.add(Severity.INFO, "test message");
          }
      }



      It works great when the method is not Asynchronous...
      It works also if a call the Asynchronous method from a synchronous method...but then I have to wait till the end of the treatment so I lose the advantages of @Asyncronous.


      Any idea ?
      Thank you