5 Replies Latest reply on Mar 13, 2007 4:20 PM by login4jbr

    Callback Questions

    login4jbr

      Hello.

      I have a couple of questions.

      1. When the server sends callbacks to the client, are the callbacks delivered in the same order they have been sent?

      In other words:

      If the server sends a callback C1 and then another callback C2.

      Can I be sure that the client will receive first C1 and then C2?


      2. My clients have specific identifiers.

      Eg. Client 1 has identifier "peter"
      Client 2 has identifier "charles", and so on.

      I want give these identifiers to the server in such a way that the server can associate each identifier with the corresponding client's callbackhandler.

      Is possible to pass the identifier to the server when registering the client's callbackhandler?

      Is there some other way to do it?


      Thanx for the help.

        • 1. Re: Callback Questions
          ron_sigal

          Hi,


          1. When the server sends callbacks to the client, are the callbacks delivered in the same order they have been sent?


          1. Pull callbacks are retrieved in the order that the ServerInvocationHandler passes them by way of InvokerCallbackHandler.handleCallback().

          2. The situation for push callbacks is somewhat more complicated and transport specific. When the ServerInvocationHandler calls InvokerCallbackHandler.handleCallback() for a push callback, a client invoker on the server side makes an invocation on the callback server invoker on the client side. If callback A is generated and then callback B is generated a second later, it's very likely that callback A will arrive before callback B. However, there may be some nondeterminism according to the transport and its configuration. The client invoker of the socket transport (and its descendants) maintains a connection pool, and if callbacks A and B are generated in quick succession, it is possible for them to go out over two different connections and for callback B to arrive before callback A.

          If you need to preserve determinism, you can configure the connection pool to have no more than one connection by setting org.jboss.remoting.transport.MicroSocketClientInvoker.MAX_POOL_SIZE_FLAG to "1" in the Client's configuration map.

          There's also a new, and as yet undocumented, facility for registering a listener which will receive acknowledgements that callbacks have been delivered, and that could be used, at the cost of some latency, to serialize the delivery of callbacks. I need to write that documentation in the next few days, and when it's done I'll post a pointer to it.



          Is possible to pass the identifier to the server when registering the client's callbackhandler?


          In the interest of completeness I should say that the phrase "the client's callbackhandler" is somewhat ambiguous. (1) A single callback handler could be passed to multiple Clients. (2) Some versions of Client.addListener() create a callback Connector as a convenience. If a single callback handler is passed to one of these methods on the same Client, it will appear on the server side to be two callback handler instances.

          Let's assume, though, that you have a one-one relationship between callback handlers and Clients. Each client is endowed with a unique session ID when it is created, and each callback handler that is passed to an addListener() method of Client A is given the session ID of Client A. That session ID can be retrieved on the server side by casting to ServerInvokerCallbackHandler the InvokerCallbackHandler passed in to ServerInvocationHandler.addListener() and calling getClientSessionId() on it. For more information, see the thread

          http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024506#4024506

          • 2. Re: Callback Questions
            login4jbr

            Hi :-)

            Thank you very much for the reply.

            1. The callbacks delivering order is very important in my app, so I really need determinism.

            I'm using push callbacks and the socket transport, so I will configure the connection pool as you say.


            2. I didn't know that you can put a personalized session ID in the Client.
            That's just what I need.


            Your help was great, thanx!

            • 3. Re: Callback Questions
              login4jbr

               

              If you need to preserve determinism, you can configure the connection pool to have no more than one connection by setting org.jboss.remoting.transport.MicroSocketClientInvoker.MAX_POOL_SIZE_FLAG to "1" in the Client's configuration map.


              Exactly where should I put this configuration?

              Should I put it in the Client object created in the client side?

              If you put it in the Client object created in the client side, this will affect the callback connection pool or the call connection pool?

              • 4. Re: Callback Questions
                ron_sigal

                You want to configure the max pool size value for the callback client invoker on the server side. The configuration map you pass to the server side Connector will get passed to the server invoker, which will pass it to the callback client invoker when you add a callback listener. In other words, you want to put a value for MAX_POOL_SIZE_FLAG in the configuration map for the server side Connector.

                • 5. Re: Callback Questions
                  login4jbr

                  Whoa!

                  thanx a lot.