[jboss-user] [Remoting] - Re: P2P Client Callback with streaming

ron.sigal@jboss.com do-not-reply at jboss.com
Fri Apr 25 22:33:53 EDT 2008

anonymous wrote : 
  | Question 1:
  | Is it possible to have each clients socket context connection saved in the server so that the server can do a push to the registered clients? I am not too sure if the pull / push callbacks are the right way to go forward. The "Mina" framework offers this feature, if I can remember right.

Yes. Each client could call org.jboss.remoting.Client.addListener() which, depending on the details of the call, will register an implementation of org.jboss.remoting.callback.InvokerCallbackHandler to receive push (or polled) callbacks.  On the server side, your implementation of org.jboss.remoting.ServerInvocationHandler will be informed of the existence of the newly registered InvokerCallbackHandler through a call to ServerInvocationHandler.addListener().  Your ServerInvocationHandler can add the InvokerCallbackHandler to a list of InvokerCallbackHandlers waiting for callbacks.

anonymous wrote : 
  | Question 2:
  | Will the client push from the server work for clients behind NAT firewall. 

Yes. Push callbacks are processed by a client-side callback Connector.  You can create the callback Connector with "clientConnectAddress" and "clientConnectPort" parameters which will tell the server how to connect to the callback Connector.

anonymous wrote : 
  | Question 3:
  | Secondly, we would also like to utilize the streaming feature to distribute documents among peers. Can the similar solution be used for streaming documents among group

This one's a little tricky.  Streaming is not a fully developed feature in the current version of Remoting.  It is possible to send streams from the client to the server.  There is not currently an explicit mechanism for sending streams from the server to the client.  However, push callbacks are handled by creating an org.jboss.remoting.Client on the server side and then calling Client.invoke().  Your implementation of ServerInvocationHandler.addListener() could cast the incoming InvokerCallbackHandler to org.jboss.remoting.callback.ServerInvokerCallbackHandler and call ServerInvokerCallbackHandler.getCallbackClient() to get the Client used to send push callbacks.  I guess you could then use that callback Client to send streams to the client-side callback Connector.  I've never tried it, but it sounds plausible.

By the way, there's a sample chat room application in org.jboss.remoting.samples.chat.*.  I wrote it a long time ago and don't remember much about it, but it does use callbacks.

I'm sorry if my answer was too late to be of any use. 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4146960#4146960

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4146960

More information about the jboss-user mailing list