Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 35373 invoked from network); 11 Dec 2009 15:34:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Dec 2009 15:34:29 -0000 Received: (qmail 78310 invoked by uid 500); 11 Dec 2009 15:34:29 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 78242 invoked by uid 500); 11 Dec 2009 15:34:29 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 78232 invoked by uid 99); 11 Dec 2009 15:34:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Dec 2009 15:34:29 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of gary.tully@gmail.com designates 209.85.218.215 as permitted sender) Received: from [209.85.218.215] (HELO mail-bw0-f215.google.com) (209.85.218.215) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Dec 2009 15:34:18 +0000 Received: by bwz7 with SMTP id 7so741485bwz.6 for ; Fri, 11 Dec 2009 07:33:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=XLMXm6vtSSqbqEKeGsL9eCZtu641YWfOEthOpnnXx6U=; b=HoYhQb2O8ALIvrUHspF4+V52Dq8+Mwfg0BMz6ztPwC4ZCEo5RwgoRLmFpvBG/+LDAJ 5KcTAAsuArNnS9s0Q9E1STHb0ZdBecvsMs+MdnmLAkT9BwmO+6r6VjC2QS0cILciwqAu uuyHqzZFDj7sPo9dqTe4VcfafcLXLRfG4LK1Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=Z8AIEuXYNNTvrFyWOC+L1KNpHRbu+XUg68ZxuzTqBRt7SUvSX8dWBcZbSryCqxQrWd YVjafbppkgBQAskO6qFsqvY/o19HMKB6iu31Uqbr7MKKmDFSqXWibbTLAlUY7tEEB5kX AdwxlBOuWEkPBPkgRa9bv14+eDMM6VfjxPWfs= MIME-Version: 1.0 Received: by 10.204.154.85 with SMTP id n21mr817981bkw.171.1260545637915; Fri, 11 Dec 2009 07:33:57 -0800 (PST) In-Reply-To: <71e1b5740912110720j345fd147xe41898ad967d9e30@mail.gmail.com> References: <71e1b5740912110411n51b69310td8ef75cacb358db0@mail.gmail.com> <3a73c17c0912110440kf8e028fqb6b3dde6ec7bd64d@mail.gmail.com> <71e1b5740912110449h358f7a44jda213c5878f748b9@mail.gmail.com> <3a73c17c0912110522p42061cfdk1a4f88ee40600ebd@mail.gmail.com> <71e1b5740912110557o4bffa2eai980fb34ef371b2ff@mail.gmail.com> <3a73c17c0912110653v5932e7du22cc60c8d5ae99cf@mail.gmail.com> <71e1b5740912110720j345fd147xe41898ad967d9e30@mail.gmail.com> Date: Fri, 11 Dec 2009 15:33:57 +0000 Message-ID: <3a73c17c0912110733q73dd99d5re5b55f434049ba2a@mail.gmail.com> Subject: Re: Browsing a queue in a distributed broker network sometimes not seeing messages From: Gary Tully To: users@activemq.apache.org, antelder@apache.org Content-Type: multipart/alternative; boundary=0015175d0a3cf89add047a75a62c X-Virus-Checked: Checked by ClamAV on apache.org --0015175d0a3cf89add047a75a62c Content-Type: text/plain; charset=ISO-8859-1 2009/12/11 ant elder > Ok, i'll have to think about that option. Going back to what you said > earlier about statically configured destinations on the network > connector, is it right that the static destination only needs to be > configured at the remote end of the network connector? yea. a network connector is one way, unless configured as duplex. > Eg without > changing the put code i tried replacing the addNetworkConnector in > that browse code from the first email with this: > > NetworkConnector nc = > broker2.addNetworkConnector("multicast://default"); > ActiveMQDestination destiantion = new ActiveMQQueue("d1"); > nc.addStaticallyIncludedDestination(destiantion); > > and that does then get the first browse working. > > Looking at the doc on addStaticallyIncludedDestination at > http://activemq.apache.org/networks-of-brokers.html near the bottom of > the page its says "N.B. You can use wildcards in inclusive , exclusive > destination properties" but trying a destination of "d*" doesn't seem > to work, are wild cards not applicable in the statically included > destinations? > correct, they are not applicable as it is not possible to know up front what they would need to expand to. I tidied up that little NB in the doc to add an 'only' clause > Even without wild cards this may be enough as i might be able to > organize the clients to workout the set of destination they're > interested in before starting the client broker. > > ...ant > > On Fri, Dec 11, 2009 at 2:53 PM, Gary Tully wrote: > > interesting... this could work but would have some limitations. If you > use a > > regular consumer, client ack with prefetch=0 and don't ack, by using a > > blocking receive(timeout) - the demand will have time to propagate and > the > > messages will be visible. > > However, because the network is store and forward, the message will only > be > > visible from one broker at a time and following a forward, only from > another > > broker. Currently the network does not allow forwarding back to an > > originator as this can lead to out of control message bouncing. > > > > You will also have to, at some stage, delete the message which may > require > > locating the broker that currently holds the message. > > > > 2009/12/11 ant elder > > > >> Heh, well its probably not a very valid use case of ActiveMQ - I was > >> toying with using an ActiveMQ broker network for a sort of simple > >> distributed storage, with clients able to put a message on a queue and > >> have other clients read the message nondestructively. None of the > >> other technologies for that type of thing that I've looked at seemed > >> do quite what i wanted in a simple way with a good license. The > >> ActiveMQ network facilities look pretty powerful and easy to use to > >> setup a distributed network so it would be perfect if there was a way > >> to get the messages replicated to any client. > >> > >> ...ant > >> > >> On Fri, Dec 11, 2009 at 1:22 PM, Gary Tully > wrote: > >> > fraid not. What is your use case? > >> > > >> > 2009/12/11 ant elder > >> > > >> >> 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 > >> 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 > >> >> > > >> >> >> 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 > >> > > >> > > > > > > > > -- > > http://blog.garytully.com > > > > Open Source Integration > > http://fusesource.com > > > -- http://blog.garytully.com Open Source Integration http://fusesource.com --0015175d0a3cf89add047a75a62c--