activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marlon Santos <msan...@exist.com>
Subject Re: QueueBrowser in embedded broker not getting any messages
Date Tue, 21 Nov 2006 09:01:37 GMT

Hi,

I looked into your code, but i can't end into a specific conclusion as to
what the problem was... 
Try to change

      javax.jms.Queue queue =
(javax.jms.Queue)jndiUtil.getJndiEntry(queueName);

to
     queue = session.createQueue(subject);

If it fails, can you please paste all the classes that you use in here or
just upload and create a link, so that we cant look into it better, because
the code you pasted was insufficient.

Regards,
Marlon


Priya Parvatikar wrote:
> 
> Hi,
> 
> I am trying to use a QueueBrowser to browse messages sent using an
> embedded broker.  I am using ActiveMQ version 4.0.2.  The broker is set up
> using 
> 
> new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
> 
> However the QueueBrowser doesn't appear to get any messages i.e.
> browser.getEnumeration().hasMoreElements() returns false.  Here's the code
> I am using - 
> 
> public void initialise(){
>     try {
>         ConnectionFactory connFactory = new
> ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");		
>         Connection connection = connFactory.createConnection();
>         Session session = connection.createSession(false,
> Session.AUTO_ACKNOWLEDGE);
>         javax.jms.Queue queue =
> (javax.jms.Queue)jndiUtil.getJndiEntry(queueName);
>         browser = session.createBrowser(queue);
>         connection.start();
>     } catch (NamingException e) {
> 	System.err.println("Got NamingException : " + e.getMessage());
>     } catch (JMSException e) {
> 	System.err.println("Got JMSException : " + e.getMessage());
>     }
> 
> }
> 
> public void browseMessages {
>     try {
>         Enumeration msgEnum = browser.getEnumeration();
>         System.out.println("has more elements is " +
> msgEnum.hasMoreElements());
>     }catch (JMSException e) {
> 	System.err.println("Got JMSException : " + e.getMessage());
>     }
>     
> }
> 
> The initialise() method is called before the sender sends messages to the
> queue and the browseMessages() method is called after the sender has sent
> a message.  Could you please advise me about this?  Apologies if I am
> missing something obvious.
> 
> Thanks,
> Priya
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/QueueBrowser-in-embedded-broker-not-getting-any-messages-tf2677079.html#a7467853
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message