qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gordon Sim <g...@redhat.com>
Subject Re: [java] Question on implementing queue browsing
Date Wed, 06 Dec 2006 10:12:11 GMT
Das, Kapali Tejeswar wrote:
> Carl,
> I didn't find queue browsing mentioned in the AMQP 0.8 spec. That
> explains the fact that there is no implementation in Qpid to browse the
> messages in the queue.
> My work is essentially to implement the JMS QueueBrowser feature that
> would return a java.util.Enumeration which the caller uses to browse the
> messages. JMS doesn't provide any guideline as to how it should be
> implemented. Ideally, we may want to take the snapshot of all the
> messages in the queue and present to the user. That way it (browsing)
> won't have any effect on any other threads that are actively
> producing/consuming messages.
> In order to build the snapshot of the messages, we need to be able to
> read a message without removing it from the queue. SynchronousQueue
> doesn't support this.
> Any feedback is greatly appreciated.
> Thanks and regards
> Tej

The SynchronousQueue is I think only used in BasicMessageConsumer for 
the case where the client is pulling messages from the consumer rather 
than having them pushed to a MessageListener implementation. The queue 
that holds all received messages for the session is of type 
FlowControllingBlockingQueue (in the util package).

Regardless, as I think has been covered, the browse behaviour should 
enumerate the messages on a broker queue without consuming them (i.e. it 
shouldn't just browse the list of messages received but not delivered).

I don't believe there is a way of retrieving messages from a queue 
without consuming them in the current protocol, so some change will need 
to be proposed. There was a discussion about such a proposal a long time 
ago amongst some members of this list. I've attached a very rough 
outline of what I remember of that design.

The attached approach attempts to add a browsing function to AMQP that 
can be used to implement the JMS queue browsing, but gives slightly 
stronger semantics than required in order to potentially be more useful. 
   It allows a client to detect that the queue has been altered as it 
browses, though whether it cares about this is implementation dependent. 
Other designs are of course possible, this is just a suggestion as a 
starting point (one useful modification could be the ability to retrieve 
batches rather than just individual messages).

View raw message