Callback acknowledgements
ron_sigal Sep 28, 2006 3:15 AMIntegrating the Remoting http transport into JBossMessaging has uncovered a requirement in Messaging for Remoting callbacks to generate acknowledgements, and we're soliciting comments on the nature of these acknowledgements.
Messaging will be using push callbacks, or, in the case of unidirectional transports (e.g., socket, http), "pseudo-push" or "poll" callbacks, in which an org.jboss.remoting.callback.CallbackPoller polls the server for callbacks and then pushes them to an InvokerCallbackHandler. The CallbackPoller acts in place of the server side ServerInvokerCallbackHandler, which handles pure push callbacks. The requirement in Messaging is to get an acknowledgement when InvokerCallbackHandler.handleCallback() has returned. This acknowledgement can be sent by CallbackPoller or ServerInvokerCallbackHandler in the cases of pseudo-push and push callbacks, respectively.
Beyond these requirements from Messaging, we're looking for the right set of acknowledgement concepts and the right set of API changes to implement them. The main question is: What does an acknowledgement mean? Messaging needs an acknowledgement that indicates that the callback has been transferred to the client. Now, it seems desirable for the implementation of a CallbackListener interface to be independent of how callbacks are configured, which raises the question of how pull callbacks should be acknowledged. An acknowledgement sent just before Client.getCallbacks() returns would be an approximation to indicating that the callback has been passed to the client. The advantage of sending acknowledgements from Client, CallbackPoller, and ServerInvokerCallbackHandler is that they are all handled inside of Remoting and require no application level action on the client side.
However, the pull callback acknowledgement is liable to spawn race conditions. A stronger kind of acknowledgement would be for the application to call a new Client.acknowledgeCallback() method. It requires an API change, but it seems to offer a more reliable and conclusive acknowledgement. Moreover, this same form of acknowledgement would be available for push and poll callbacks as well.
One solution would be to have two levels of acknowledgements: Remoting and application. Either or both could be requested by the CallbackListener.
Comments?