Hi; I apologize if I am asking something obvious but I've been searching about this for a day or two, still couldn't figure out how I can treat synchronous remote calls as if they are asynchronous in my message handler. I want to make the call and instead of waiting for the response, I want to be notified when response becomes available, so that I can select the correct session and send the response back to the correct client. Apparently there's not much sample code about this in the internet.
My scenario is as follows: Client sends the message , Mina Server decodes message to Pojo and passes it to Message Handler where a Sync call is made to another server, Other server processes the message for a second or two, returns it back to message handler, and Mina Server gets the response back to the client. As you can see if I will wait for the response in the message handler, that makes things super inefficient. In a recent discussion in a topic, Emmanuel Lecharny stated that there's a way to make this synchronous call in a async fashion. Whenever response comes back, I can find he associated session and send the response back correctly. I know there's ReadFuture and WriteFuture which works with session to accomplish read and writes on session. But my problem is I am not waiting on a session event, I am waiting on a remote sync call to return an object, so that I can pass that object back to the client. My sync call is something like that RemoteProducerTool producer = RemoteProducerTool.getTool(syncUrl, syncUser, syncPwd, syncSubject); hostResponse = producer.sendSyncMessage(frame, timeout); If somebody can give a small example about how to make that call asynchronously and how to locate the correct session and send response back to correct client I'd be grateful. Believe me you won't be just helping me, you'll be helping everybody who will try to do something like that one day. Erinc
