activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Tully <gary.tu...@gmail.com>
Subject Re: Browsing a queue in a distributed broker network sometimes not seeing messages
Date Fri, 11 Dec 2009 13:22:06 GMT
fraid not. What is your use case?

2009/12/11 ant elder <antelder@apache.org>

> I see, thanks for the explanation.
>
> The statically configured destination isn't really an option as the
> queue names aren't known till runtime. Are there any other options
> that might help get the messages forwarded irrespective of demand?
>
>   ...ant
>
> On Fri, Dec 11, 2009 at 12:40 PM, Gary Tully <gary.tully@gmail.com> wrote:
> > This is expected. A queue browser takes a shapshot of the queue through a
> > short lived consumer. The network bridge is by default a demand
> forwarder,
> > such that messages are only forwarded when there are consumers on other
> > brokers.
> >
> > With the browser, the consumer (and hence demand) is transient, so it may
> > take a snapshot before the forwarding has a chance to kick in. And the
> > forwarding stops when the consumer goes away once the browse shapshot
> > completes.
> >
> > One way to make this more deterministic would be to have a statically
> > configured destination in the network connector configuration such that
> > messages for that destination are forwarded irrespective of demand.
> >
> > 2009/12/11 ant elder <ant.elder@gmail.com>
> >
> >> I'm trying to track down an problem where a queue browser on a VM
> >> connection to one AMQ broker is sometimes not seeing messages put on a
> >> queue from a VM connection to another broker in the same network. The
> >> code below can recreate the problem, running the put() on JVM and the
> >> browse() on another JVM the first QueueBrowser never sees the message
> >> but the second QueueBrowser does though sometimes it doesn't without
> >> the Thread.sleep for a few seconds.
> >>
> >> Is there anything obviously wrong with this setup or are there any
> >> config settings that could help?
> >>
> >>   ...ant
> >>
> >> The code to put a message on a queue:
> >>
> >>    public void put() throws Exception {
> >>        BrokerService broker1 = new BrokerService();
> >>        broker1.setBrokerName("default");
> >>        broker1.setPersistent(false);
> >>        broker1.setUseJmx(false);
> >>        TransportConnector tc =
> broker1.addConnector("tcp://localhost:0");
> >>        tc.setDiscoveryUri(URI.create("multicast://default"));
> >>        broker1.addNetworkConnector("multicast://default");
> >>        broker1.start();
> >>
> >>        Connection conn1 = new
> >>
> ActiveMQConnectionFactory("vm://default?create=false").createConnection();
> >>        conn1.start();
> >>        Session sess1 = conn1.createSession(false, 1);
> >>        Queue d1 = sess1.createQueue("d1");
> >>        MessageProducer p1 = sess1.createProducer(d1);
> >>        TextMessage m1 = sess1.createTextMessage("test");
> >>        p1.send(m1);
> >>   }
> >>
> >>
> >> The code to browse the messages on the queue:
> >>
> >>    public void browse() throws Exception {
> >>
> >>        BrokerService broker2 = new BrokerService();
> >>        broker2.setBrokerName("default");
> >>        broker2.setPersistent(false);
> >>        broker2.setUseJmx(false);
> >>        TransportConnector tc =
> broker2.addConnector("tcp://localhost:0");
> >>        tc.setDiscoveryUri(URI.create("multicast://default"));
> >>        broker2.addNetworkConnector("multicast://default");
> >>        broker2.start();
> >>
> >>        Connection conn2 = new
> >>
> ActiveMQConnectionFactory("vm://default?create=false").createConnection();
> >>        conn2.start();
> >>        Session sess2 = conn2.createSession(false, 1);
> >>        Queue d1 = sess2.createQueue("d1");
> >>        QueueBrowser b = sess2.createBrowser(d1);
> >>
> >>        Enumeration x2 = b.getEnumeration();
> >>        while (x2.hasMoreElements()) {
> >>            System.out.println(x2.nextElement()); // this never gets
> >> the message
> >>        }
> >>
> >>        Thread.sleep(5000);
> >>
> >>        b = sess2.createBrowser(d1);
> >>        Enumeration x2a = b.getEnumeration();
> >>        while (x2a.hasMoreElements()) {
> >>            System.out.println(x2a.nextElement()); // this does get the
> >> message
> >>        }
> >>
> >>    }
> >>
> >
> >
> >
> > --
> > http://blog.garytully.com
> >
> > Open Source Integration
> > http://fusesource.com
> >
>



-- 
http://blog.garytully.com

Open Source Integration
http://fusesource.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message