9 Replies Latest reply on Jan 17, 2007 9:48 AM by Aleksander Bai

    Asynchronous callbacks

    Aleksander Bai Newbie

      How can i achieve asynchronous callbacks in a stateless/statefull bean?

      Scenario: A client send a request to a bean (ie do some processing of some large data). The bean returns a answer immidiately to the client, but wants to be able to tell the client on the progress and the final results. The client has a method which is dedicated to handle these callbacks. How can the bean send asynchronous callbacks to the client?

      I've tried by sending the Method as a argument to the bean:
      public String getAsynhcString(Method client, String test)

      and the client invoke this by:
      test.getAsynhcString(this.getClass().getMethod("callmeback", String.class), "hello");

      The callmeback method of the client is on this form:
      public void callmeback(String res)

      However, when trying this, I get a marshalling exception: java.io.NotSerializableException: java.lang.reflect.Method
      which is very unfortunately.

      wondering if there are any suggestions on how i should accomplish my goal?