activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: Discovering queues programmatically and dequeuing messages off of them
Date Thu, 18 Sep 2008 14:50:27 GMT
I'd start() the connection first - then wait a few seconds; the
advisories are asynchronously sent once a connection starts

2008/9/18 kpalania <kpalania@yahoo.com>:
>
> Thanks James but this piece of code does not seem to return all the queues on
> the broker. Any thoughts on why that would be the case?
>
> -------------------------------------------------------------------------------
>  public void testGetAllQueues()
>  {
>    ActiveMQConnectionFactory connectionFactory = new
> ActiveMQConnectionFactory(BROKER_URL);
>    Connection connection;
>    try
>    {
>      connection = connectionFactory.createConnection();
>
>      DestinationSource ds = new DestinationSource(connection);
>      Set<ActiveMQQueue> queues = ds.getQueues();
>      System.out.println("..size: " + queues.size());
>      Iterator i = queues.iterator();
>      while (i.hasNext())
>      {
>        Queue q = (Queue) i.next();
>        System.out.println("..q: " + q.getQueueName());
>      }
>
>      session.close();
>      connection.close();
>    }
>    catch (JMSException e)
>    {
>      // TODO Auto-generated catch block
>      e.printStackTrace();
>    }
>
>  }
>
> --
> View this message in context: http://www.nabble.com/Discovering-queues-programmatically-and-dequeuing-messages-off-of-them-tp19538405p19554303.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>



-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Mime
View raw message