You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by scottmiller <sc...@gmail.com> on 2007/12/22 00:05:26 UTC

support for asyncrhonous messaging on a per-connection basis

I saw this in another posting:

"And, if your client sends messages asynchronously (i.e. sends requests
before all previous responses are received.), any incoming messages
will be buffered in the internal queue until your messageReceived()
method returns.  The queue is maintained on a per-session basis, so
any other sessions won't be affected when one session's
messageReceived() runs long."

Are there plans in an upcoming MINA release to support asynchronous
messaging on a per-connection basis?  Any known workarounds?

-- 
View this message in context: http://www.nabble.com/support-for-asyncrhonous-messaging-on-a-per-connection-basis-tp14463996s16868p14463996.html
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: support for asyncrhonous messaging on a per-connection basis

Posted by Qi <sa...@gmail.com>.
Hi there,

I believe that every time a connection is built, there's a session being
created with it. So per-connection based protocol is really just a special
case of per-session protocol.
If you don't expect the server to send you any response, you may do
something like
<code>
WriteFuture wf = session.write(Message msg);
wf.join();
CloseFuture cf = session.close();
cf.join();
</code>
to close the session and connection after you finish sending you message.
Alternatively, 
You can add a IoFutureListener, which will be notified once a IoFuture's
status is changed, to close the session.

If you do expect the server to send some response message, you can do the
same thing in the IoHandler you give to your IoConnector. In which case, you
would have to use IoFutureListener in order to avoid deadlock.

Cheers,
Qi


scottmiller wrote:
> 
> I saw this in another posting:
> 
> "And, if your client sends messages asynchronously (i.e. sends requests
> before all previous responses are received.), any incoming messages
> will be buffered in the internal queue until your messageReceived()
> method returns.  The queue is maintained on a per-session basis, so
> any other sessions won't be affected when one session's
> messageReceived() runs long."
> 
> Are there plans in an upcoming MINA release to support asynchronous
> messaging on a per-connection basis?  Any known workarounds?
> 
> 

-- 
View this message in context: http://www.nabble.com/support-for-asyncrhonous-messaging-on-a-per-connection-basis-tp14463996s16868p14475983.html
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: support for asyncrhonous messaging on a per-connection basis

Posted by Trustin Lee <tr...@gmail.com>.
Hi Scott,

On Dec 22, 2007 8:05 AM, scottmiller <sc...@gmail.com> wrote:
>
> I saw this in another posting:
>
> "And, if your client sends messages asynchronously (i.e. sends requests
> before all previous responses are received.), any incoming messages
> will be buffered in the internal queue until your messageReceived()
> method returns.  The queue is maintained on a per-session basis, so
> any other sessions won't be affected when one session's
> messageReceived() runs long."
>
> Are there plans in an upcoming MINA release to support asynchronous
> messaging on a per-connection basis?  Any known workarounds?

A session is a connection in MINA TCP transport.  So... I think what
you want is already there.

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6