Might be worth adding a comment to org.apache.qpid.server.model.Queue to reflect this.

did I mention comments.....

Frase

On 07/03/14 15:26, Rob Godfrey wrote:
.. and to answer myself for a third time... yes that was the issue

both AMQQueue (the "implementation" interface) and Queue (the "model"
interface) define getConsumers(), with each returning a collection of their
own brand of Consumers....

AbstractQueue (the concrete implementation) implements both, and reutrns a
Collection of Consumer implementation objects which meets both these
definitions... and compiles fine in 1.7, but 1.6 barfs... Rather than try
to find a way of forcing the 1.6 compiler to work, I just removed from the
Queue interface as getChildren(Consumer.class) does the same thing and
getConsumers() was unused in the core codebase.


On 7 March 2014 16:13, Rob Godfrey <[email protected]> wrote:



On 7 March 2014 16:07, Fraser Adams <[email protected]> wrote:

Why have you removed getConsumers() from org.apache.qpid.server.model.
Queue?

I was using that!

                     for (Consumer subscription : queue.getConsumers())
                     {
                         childAdded(queue, subscription);
                     }


So in order to be able to navigate between a Connection and a Queue you
wind up with Connection, Session, Subscription (AKA Consumer) and Queue. I
maintained the references between Session and Queue via Consumer e.g. in
childAdded() in QmfManagementAgent I do:


You can do

for(Consumer subscription : queue.getChildren(Consumer.class))

I would think...

Not sure why it got removed - probably just as it wasn't being
referenced... although it might have been some sort of clash between the
AMQQueue and Queue versions of getConsumers() causing issues when they
merged their functions

-- Rob

         else if (child instanceof Consumer) // AKA Subscription
         {
             // Subscriptions are a little more complex because in QMF
Subscriptions contain sessionRef and queueRef
             // properties whereas with the Java Broker model Consumer is
a child of Queue and Session. To cope with
             // this we first try to create or retrieve the QMF
Subscription Object then add either the Queue or
             // Session reference depending on whether Queue or Session
was the parent of this addChild() call.
             if (!_objects.containsKey(child))
             {
                 data = new org.apache.qpid.server.qmf2.
agentdata.Subscription((Consumer)child);
                 _objects.put(child, data);
            }

             org.apache.qpid.server.qmf2.agentdata.Subscription
subscription =
(org.apache.qpid.server.qmf2.agentdata.Subscription)_objects.get(child);

             QmfAgentData ref = _objects.get(object);
             if (ref != null)
             {
                 if (object instanceof Queue)
                 {
                     subscription.setQueueRef(ref.getObjectId(),
(Queue)object);
                     // Raise a Subscribe Event - N.B. Need to do it
*after* we've set the queueRef.
_agent.raiseEvent(subscription.createSubscribeEvent());
                 }
                 else if (object instanceof Session)
                 {
                     subscription.setSessionRef(ref.getObjectId());
                 }
             }
         }


getConsumers() still seems to be present in AMQQueue.java and in
AbstractQueue.java so I hope that it was just "over zealous" tidying of the
org.apache.qpid.server.model.Queue interface - I'd quite like to have it
back please.


Frase






---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to