3 Replies Latest reply on Mar 9, 2012 6:52 PM by Nigel Deakin-Oracle

    Strange behavior with QueueBrowser


      I am using a QueueBrowser along with a QueueReceiver for my application and notice behavior that is strange. Here is the logic :

      a) I create a QueueBrowser against a queue and take a snapshot of whats on the queue.
      b) I loop through the enumeration of messages on the queue and determine for each message , if the message is ready to be processed now(based on some logic).
      c) If in step (b), i determine that the message is ready to be processed, i create a runnable and submit the runnable to a thread pool for processing.
      d) The runnable uses a queue receiver to receive a specific message off the queue using a message selector and processes the message.

      What i notice is if the receiver tries to receive a message that the browser has already seen, at times the receive method returns null. But eventually after many failed attempts, the receiver can pull the message off the queue using the message selector. Also, i notice that when the receive timeout is set to NO_WAIT,
      the receive call fails before succeeding eventually. But if i use the receive method with a couple of seconds timeout, it does seem to receive successfully every time.

      Any thoughts on why this behavior would happen?