2 Replies Latest reply on Apr 22, 2011 12:34 AM by Dmitry Egorov

    Can I get CallbackHandleObject on server side

    Dmitry Egorov Newbie

      Hi, everybody!

        I am newbie in JBoss remoting.

      I found nice article about Callbacks http://www.mastertheboss.com/jboss-application-server/155-jboss-remoting-callbacks.html

      Everything works fine, but i need one more.

        Some code from sample.

      Client side:

      1. String callbackHandleObject = "myCallbackHandleObject"
      2. remotingClient.addListener(callbackHandler, callbackLocator, callbackHandleObject); 

      Server side:


      1. public void addListener(InvokerCallbackHandler callbackHandler) 
      2.         { 
      3.             System.out.println("Adding callback listener."); 

      Can i get myCallbackHandleObject in addListener() context and how?

      I know, i can get this object in context of client method handleCallback(Callback arg0), but that don't suite.

         Some explanations.

          This info i plan to use for some filtration for data pused by callback to client.

         Thanks in advance!

        Sincerely, Egorov Dmitry.

        • 1. Can I get CallbackHandleObject on server side
          Ronald Sigal Master

          Hi Dimitri,


          The callbackHandleObject is used only on the client side.  Here's something you can try.  Instead of calling the Client method


             public void addListener(InvokerCallbackHandler callbackHandler,

                                     InvokerLocator clientLocator, Object callbackHandlerObject);




             public void addListener(InvokerCallbackHandler callbackhandler, Map metadata,

                                     Object callbackHandlerObject) throws Throwable;


          and put some identifying information in the metadata map:


            HashMap metadata = new HashMap();

            metadata.put("key", "tag");

            client.addListener(..., metadata, ...);


          Then on the server side, in your ServerInvocationHandler method


             public void addListener(InvokerCallbackHandler callbackHandler);


          do something like


            ServerInvokerCallbackHandler serverInvokerCallbackHandler = (ServerInvokerCallbackHandler) callbackHandler;

            Client callbackClient = serverInvokerCallbackHandler.getCallbackClient();

            Map config = callbackClient.getConfiguration();

            String tag = config.get("key");


          I haven't tested it, but it looks plausible.  By the way, thanks for the reference to that article.  I never heard of it before.


          Good luck,


          • 2. Can I get CallbackHandleObject on server side
            Dmitry Egorov Newbie

            Hi Ron,

               Thanks for answer!

            I try it, but it seem didn't work:

            after call

              Client callbackClient = serverInvokerCallbackHandler.getCallbackClient();

            callbackClient is null.

            I solve my problem by creation one callback channel for each filter.


              Good luck,