Hello,

I have had some rather inconsistent results when trying to retrieve a list
of queues via the DestinationsSource.getQueues() method. I have an existing
connection object and try to retrieve the DestinationSource using
connection.getDestinationSource().getQueues() but it works correctly on my
laptop environment but doesn't work on servers where deployed. I have the
following code to test:


public final void testHasQueue( name ) 
{
        try
        {
                ActiveMQConnection connection =
ActiveMQConnectionFactory.createConnection("tcp://127.0.0.1:61616");
                connection.start();
                
                DestinationSource ds = new DestinationSource( connection );
                        
                Set<ActiveMQQueue> q = ds.getQueues();
                        
                Iterator i = q.iterator();
                        
                while ( i.hasNext() )
                {
                        ActiveMQQueue que = (ActiveMQQueue)i.next();
                                
                        System.out.println("Queue found: " + 
que.getPhysicalName() );

                        if ( que.getPhysicalName().equals( name ) )
                        {
                                System.out.println("The queue " + 
que.getPhysicalName() + " exists!");
                                exit;
                        }
                                
                }
                        
                connection.stop();
                connection = null;
                ds = null;
        }
        catch (Exception e)
        {
                e.printStackTrace();
        }
                
}



-- 
View this message in context: 
http://www.nabble.com/AMQ5.1.0---HELP%3A-Correct-way-of-retrieveing-a-DestinationSource-tp18134728p18134728.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Reply via email to