Dear Faces community,
This is my first contribution to the mailing list. Very happy to do so after years of benefitting from this great framework.
My
 question is about an issue I encounter with a Stateless EJB containing 
an @Aynchronous method. When this method returns, it triggers a callback
 in a SessionScoped bean, which is using 
FacesContext.getCurrrentInstance() to then navigate to a new page.
The
 issue: FacesContext.getCurrrentInstance() throws an error. This is due,
 AFAIK, to the single thread model of statefull beans in JSF. Inter 
thread communication as the one I am trying doesn't maintain state. Is 
there a workaound it?
A simplified code version:
@Stateless
public class LongRunningProcessBean {
    @Asynchronous
    public void executeLongRunningOperation(Consumer<String> callback) {
        // retrieve topNodes...
        // Invoke the callback when top nodes have bee retrieved
        callback.accept("success!");
    }
}
@Named
@SessionScoped
public class CowoBean {
    @EJB
    private LongRunningProcessBean longRunningProcessBean;
    public void startLongRunningOperation() {
        longRunningProcessBean.executeLongRunningOperation(this::onOperationComplete);
    }
    private void onOperationComplete(Strint result) {
            if (result.equals("success"){
               FacesContext context = FacesContext.getCurrentInstance(); // **error, not able to retrieve Context**
               context.getApplication().getNavigationHandler().handleNavigation(context, null, "/cowo/results.xhtml?faces-redirect=true");
            }
    }
}
  
The thread on Twitter where I first discussed the issue:
Thank you and best regards,
Clement