On 8/22/06, blueshed <[EMAIL PROTECTED]> wrote:

That would help. But surely the same mechanism could be used with single
outstanding messages as then an ACK with a RECEPIT would also mean that I
would get the RECIEPT before the next message?

I have not problem with the asychronous nature of the messaging, just the
order of messages. I cannot put it in a buffer, because not further messages
come until I ack and the ack has a receipt request on it - so I am
effectively blocked.


I don't follow.  no further messages come, but RECEIPTS will still come.

Lets say we have the following code... send subscribe, wait for it's
ack, and get 2 messages:

client sends SUBSCRIBE;
waitForReceipt() ;
receiveWithAutoAck();
receiveWithAutoAck();

if receiveWithAutoAck waitForReceipt are implemented as follows I
don't see how out of order async RECEIPTS would be a problem.

receiveWithAutoAck() {
    if ( buffer is empty ) {
       client blocks reading socket
       client receives MESSAGE
    } else {
       get the first message from the buffer.
    }
    client sends ACK
    waitForReceipt();
    return the message;
}

waitForReceipt() {
      while (have not receive receipt)  {
         client blocks reading socket
         if( we get a MESSAGE )
            add MESSAGE to the end of the buffer
         else
             return the receipt
      }
}



James.Strachan wrote:
>
> On 8/22/06, Hiram Chirino <[EMAIL PROTECTED]> wrote:
>> Hi Peter,
>>
>> Yes.. Unfortunately this is how asynchronous messaging works.  There
>> is no way around it unless you switch to a request/reply model like
>> HTTP uses.  But then you loose all the performance gains that a
>> asynchronous model provides!
>>
>> If your application is single threaded, you should place those
>> unexpected messages into a buffer while your are polling for your
>> response.  Then when your application does a receive(), it should
>> first check that buffer for messages and nothing is there, then it
>> should wait on the socket for dispatched messages.
>
> Agreed - though maybe we could enforce the RECEIPT of the SUBSCRIBE
> first before we dispatch any messages?
> --
>
> James
> -------
> http://radio.weblogs.com/0112098/
>
>

--
View this message in context: 
http://www.nabble.com/Stomp-Receipts-tf2145063.html#a5933510
Sent from the ActiveMQ - User forum at Nabble.com.




--
Regards,
Hiram

Blog: http://hiramchirino.com

Reply via email to