Hello all.
I think I'm misunderstanding something fundamental about how the IoSession.suspendRead() and IoSession.resumeRead() methods work and I would appreciate any insight you guys can offer. I have a producer and consumer both based on Mina. What I want to achieve is to block the producer while the the consumer is still processing the message.

The way I thought I could do this was do something like this in the producer 
side:

[...]
WriteFuture wf = ioSession.write(message);
wf.awaitUninterruptibly();
[...]

and in the consumer side:

public void messageReceived(IoSession iosession, Object message) throws 
Exception
{
long readMsg = iosession.getReadMessages();
iosession.suspendRead();
[... slow message processing ...]
iosession.resumeRead();
}

I was under the impression that the iosession.suspendRead() would make the producer block, but this is not the behaviour I'm seeing. What I'm seeing is that the even with the IoSession in suspend state the producer manages to successfully write the messages and the iosession.getReadMessages() in the consumer side keeps getting bigger. Are my expectations wrong? Is there any way I can achieve the desired behaviour with Mina?

I'm using a very recent trunk snapshot.

Thanks.

--
Luis Neves

Reply via email to