Jon,
> I've just subscribed and I note from the archive that a problem like
> this has been noted, but perhaps not resolved.
>
> My code tries:
>
> channel.sendMSG(msg1,reply1);
> channel.sendMSG(msg2,reply2);
> channel.sendMSG(msg3,reply3);
>
> then I try to read the replies. I've also tried using reply1 three times.
>
> The problem appears to be with ThreadedMessageListener, which assigns
> the received message to a field before spawning a thread to process the
> message.
>
> public void receiveMSG(Message message) // simplified
> {
> this.message = (MessageMSG)message;
> callbackQueue.execute(this);
> }
>
> If another message is received before the first is processed it
> overwrites the field. For this reason, I get "Incorrect message number:
> was 3; expecting 1".
>
> I'm pulling down the CVS copy to try this fix:
>
> public void receiveMSG(Message message) // simplified
> {
> callbackQueue.execute(new MessageProcessor(message));
> }
>
> where a new MessageProcessor inner class holds the original run().
>
> Comments welcome; should this parallel messaging in a single channel
> work in the first place? - I can't find any examples.
Thanks for the email! This is a known problem and I have a solution in mind.
What you are doing is valid, it is ok to send another request before
receiving the reply. The problem is that the listener is suppose to process
the requests and reply to them in order and Channel is currently not
enforcing this. This is a bug that was introduced when
ThreadedMessageListener was added.
--Huston
|