Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 5825 invoked from network); 23 Sep 2010 11:55:02 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 23 Sep 2010 11:55:02 -0000 Received: (qmail 8002 invoked by uid 500); 23 Sep 2010 11:55:02 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 7689 invoked by uid 500); 23 Sep 2010 11:54:58 -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 7673 invoked by uid 99); 23 Sep 2010 11:54:57 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Sep 2010 11:54:57 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of chubrilo@gmail.com designates 209.85.214.43 as permitted sender) Received: from [209.85.214.43] (HELO mail-bw0-f43.google.com) (209.85.214.43) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Sep 2010 11:54:51 +0000 Received: by bwz16 with SMTP id 16so1838034bwz.2 for ; Thu, 23 Sep 2010 04:54:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; bh=7ayhlv0ahIRSUcm/u2xrhvdJ5bKmrHkVK81ecvfcszQ=; b=wztgt3ZGi6baqTco3oPRt02KcEmYID5UaIJ2BDXpAEp8ntk+LJu98FthkGbkOeWb/L pgFspRJEX32GGKH8CXiyda+nKuBcYqC9BY4fqcxJKOfQ5Z9DZ51FfDDJODZpdyJwnniD A6Qhfu6JLQnAkXCwHs6qgReLOBut7iuVt9lhE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=q2Pp9yDmrsp7Jh1SicCcL4uk3kqnwqPFB8kEYkXbp0azVODNKPtsM/MfpQAPl6LDPp Zp19r+NhCyYt4oDFBQaYlJTADPya+As8YTeEuh1TO8NrhjZ3LwNH+Gr+FtWM5yUUf7Mr 8IgeNX34EEKWL/cjrTpNY4Px+aEujNTLQdyc8= MIME-Version: 1.0 Received: by 10.204.112.129 with SMTP id w1mr857996bkp.204.1285242868399; Thu, 23 Sep 2010 04:54:28 -0700 (PDT) Sender: chubrilo@gmail.com Received: by 10.204.120.198 with HTTP; Thu, 23 Sep 2010 04:54:28 -0700 (PDT) In-Reply-To: <8A3B305C-46F8-4310-BA9B-04BD8D38E729@crackpot.org> References: <17398A08-419D-4619-8D57-892167733E8E@crackpot.org> <8A3B305C-46F8-4310-BA9B-04BD8D38E729@crackpot.org> Date: Thu, 23 Sep 2010 13:54:28 +0200 X-Google-Sender-Auth: inqW09gbozisB8Tgt7FUQzYtjoU Message-ID: Subject: Re: ajax clients must refresh browser to get data From: Dejan Bosanac To: users@activemq.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Hi Alex, this should be debugged a bit more. The code you should look at is MessageListenerServlet.onMessageAvailable() as there the consumers are closed when message is received with no continuation. That maybe should be revisited. You can debug it more, by adding some trace you need, start web demo module= with mvn jetty:run and test it over http://localhost:8080 Cheers -- Dejan Bosanac - http://twitter.com/dejanb Open Source Integration - http://fusesource.com/ ActiveMQ in Action - http://www.manning.com/snyder/ Blog - http://www.nighttale.net On Wed, Sep 22, 2010 at 10:16 PM, Alex Dean wrote: > Change logging levels and discovered a bit more about the problem. > > =A01. start broker & start a publisher script > =A02. view ajax page in browser. =A0receiving messages normally > =A03. shut down broker > =A04. close browser window > =A05. start broker > =A06. start publisher > =A07. view page again in browser > > This is what my logs show for the first request after the browser loads i= n #7 above: > > DEBUG | REQUEST /demo/amq on org.eclipse.jetty.server.nio.SelectChannelCo= nnector$2@4cb0f24a > DEBUG | servlet=3DAjaxServlet > DEBUG | servlet holder=3D > DEBUG | REQUEST /demo/amq on org.eclipse.jetty.server.nio.SelectChannelCo= nnector$2@7559f3f0 > DEBUG | servlet=3DAjaxServlet > DEBUG | servlet holder=3D > DEBUG | Got Session ID 3xgrpw116ot7 from cookie > DEBUG | sessionManager=3Dorg.eclipse.jetty.server.session.HashSessionMana= ger@576f8789 > DEBUG | session=3Dnull > DEBUG | chain=3D > DEBUG | call filter session > DEBUG | Got Session ID 3xgrpw116ot7 from cookie > DEBUG | sessionManager=3Dorg.eclipse.jetty.server.session.HashSessionMana= ger@576f8789 > DEBUG | session=3Dnull > DEBUG | chain=3D > DEBUG | call filter session > DEBUG | call servlet AjaxServlet > DEBUG | call servlet AjaxServlet > DEBUG | GET client=3Dorg.apache.activemq.web.WebClient@513e86ec session= =3D7ly2kihm6481 uri=3D/demo/amq query=3Dtimeout=3D45000&d=3D1285186135767&r= =3D0.6001447476869052 > DEBUG | POST client=3Dorg.apache.activemq.web.WebClient@600c199f session= =3Dsca25cn0nuu3 info=3Dnull contentType=3Dapplication/x-www-form-urlencoded= ; charset=3DUTF-8 > DEBUG | doMessage timeout=3D25000 > DEBUG | sensors (topic) > DEBUG | RESPONSE /demo/amq =A0200 > DEBUG | return with suspended request > DEBUG | Setting up new connection id: ID:rutabaga.local-60310-12851860411= 88-3:1, address: vm://localhost#2 > DEBUG | localhost adding consumer: ID:rutabaga.local-60310-1285186041188-= 3:1:-1:1 for destination: topic://ActiveMQ.Advisory.TempQueue,topic://Activ= eMQ.Advisory.TempTopic > DEBUG | 0 destination=3Dtopic://sensors message=3Dtest type=3Dlisten > DEBUG | topic://sensors is a org.apache.activemq.command.ActiveMQTopic > DEBUG | localhost adding consumer: ID:rutabaga.local-60310-1285186041188-= 3:1:1:1 for destination: topic://sensors > DEBUG | localhost adding destination: topic://ActiveMQ.Advisory.Consumer.= Topic.sensors > DEBUG | Subscribed: ActiveMQMessageConsumer { value=3DID:rutabaga.local-6= 0310-1285186041188-3:1:1:1, started=3Dtrue } to topic://sensors id=3Dtest > DEBUG | RESPONSE /demo/amq =A0200 > DEBUG | message for ActiveMQMessageConsumer { value=3DID:rutabaga.local-6= 0310-1285186041188-3:1:1:1, started=3Dtrue }continuation=3Dnull > DEBUG | remove: ID:rutabaga.local-60310-1285186041188-3:1:1:1, lastDelive= redSequenceId:0 > DEBUG | localhost removing consumer: ID:rutabaga.local-60310-128518604118= 8-3:1:1:1 for destination: topic://sensors > > My browser never receives the data which is being published to the topic.= =A0The last line ('removing consumer...') seems problematic here. > > When I close the browser window and open it again, I get... > > DEBUG | REQUEST /demo/amq on org.eclipse.jetty.server.nio.SelectChannelCo= nnector$2@7559f3f0 > DEBUG | servlet=3DAjaxServlet > DEBUG | servlet holder=3D > DEBUG | Got Session ID 7ly2kihm6481 from cookie > DEBUG | sessionManager=3Dorg.eclipse.jetty.server.session.HashSessionMana= ger@576f8789 > DEBUG | session=3Dorg.eclipse.jetty.server.session.HashSessionManager$Ses= sion:7ly2kihm6481@496418976 > DEBUG | chain=3D > DEBUG | call filter session > DEBUG | call servlet AjaxServlet > DEBUG | GET client=3Dorg.apache.activemq.web.WebClient@17cb0a16 session= =3D7ly2kihm6481 uri=3D/demo/amq query=3Dtimeout=3D45000&d=3D1285186383593&r= =3D0.9412045402828407 > DEBUG | doMessage timeout=3D25000 > DEBUG | RESPONSE /demo/amq =A0200 > DEBUG | return with suspended request > DEBUG | REQUEST /demo/amq on org.eclipse.jetty.server.nio.SelectChannelCo= nnector$2@2d11f5f1 > DEBUG | servlet=3DAjaxServlet > DEBUG | servlet holder=3D > DEBUG | Got Session ID 7ly2kihm6481 from cookie > DEBUG | sessionManager=3Dorg.eclipse.jetty.server.session.HashSessionMana= ger@576f8789 > DEBUG | session=3Dorg.eclipse.jetty.server.session.HashSessionManager$Ses= sion:7ly2kihm6481@496418976 > DEBUG | chain=3D > DEBUG | call filter session > DEBUG | call servlet AjaxServlet > DEBUG | POST client=3Dorg.apache.activemq.web.WebClient@17cb0a16 session= =3D7ly2kihm6481 info=3Dnull contentType=3Dapplication/x-www-form-urlencoded= ; charset=3DUTF-8 > DEBUG | sensors (topic) > DEBUG | Setting up new connection id: ID:rutabaga.local-60310-12851860411= 88-3:2, address: vm://localhost#4 > DEBUG | localhost adding consumer: ID:rutabaga.local-60310-1285186041188-= 3:2:-1:1 for destination: topic://ActiveMQ.Advisory.TempQueue,topic://Activ= eMQ.Advisory.TempTopic > DEBUG | 0 destination=3Dtopic://sensors message=3Dtest type=3Dlisten > DEBUG | topic://sensors is a org.apache.activemq.command.ActiveMQTopic > DEBUG | localhost adding consumer: ID:rutabaga.local-60310-1285186041188-= 3:2:1:1 for destination: topic://sensors > DEBUG | Subscribed: ActiveMQMessageConsumer { value=3DID:rutabaga.local-6= 0310-1285186041188-3:2:1:1, started=3Dtrue } to topic://sensors id=3Dtest > DEBUG | RESPONSE /demo/amq =A0200 > DEBUG | message for ActiveMQMessageConsumer { value=3DID:rutabaga.local-6= 0310-1285186041188-3:2:1:1, started=3Dtrue }continuation=3Dorg.eclipse.jett= y.server.AsyncContinuation@24cc0f9f@ASYNCWAIT > DEBUG | async request > DEBUG | REQUEST /demo/amq on org.eclipse.jetty.server.nio.SelectChannelCo= nnector$2@7559f3f0 > DEBUG | servlet=3DAjaxServlet > DEBUG | servlet holder=3D > DEBUG | sessionManager=3Dorg.eclipse.jetty.server.session.HashSessionMana= ger@576f8789 > DEBUG | session=3Dorg.eclipse.jetty.server.session.HashSessionManager$Ses= sion:7ly2kihm6481@496418976 > DEBUG | chain=3D > DEBUG | call filter session > DEBUG | call servlet AjaxServlet > DEBUG | GET client=3Dorg.apache.activemq.web.WebClient@17cb0a16 session= =3D7ly2kihm6481 uri=3D/demo/amq query=3Dtimeout=3D45000&d=3D1285186383593&r= =3D0.9412045402828407 > DEBUG | doMessage timeout=3D25000 > DEBUG | RESPONSE /demo/amq =A0200 > > At this point, my client is receiving messages normally. =A0But why do I = have to refresh the page twice in order to make this happen? > > thanks, > alex > > > On Sep 22, 2010, at 1:40 PM, Alex Dean wrote: > >> I am trying to track down a problem we see when using activemq+ajax. =A0= Sometimes when a web page (which uses amq.js) is first loaded, the amq.js P= OST & GET requests will be made as normal, but no data is returned even tho= ugh there are messages being published to the desired topic. =A0Each GET ju= st returns with an empty . =A0If we refresh = the browser, making no changes to the message publisher or the broker, then= we are able to start receiving messages. >> >> The most reliable way I'm able to reproduce is as follows: >> - Open a web browser and view a page using amq.js. >> - Restart the broker. =A0The client will (as expected) get error respons= es when trying to contact the dead broker. =A0The client will wait a few se= conds after the error, and then try again. >> - Restart the message publisher. =A0Mine (written in Ruby/stomp) always = terminates when the broker shuts down. >> - After the broker is fully started, the client will again get 200 respo= nses to its GET requests, but no messages will be received. (Although they = are being published to the topic.) >> - Refresh the browser. =A0Again, GET requests will be accepted and appea= r normal, but no data is received. >> - Refresh the browser again. =A0At this point, messages are received nor= mally. >> >> I have been able to see via Firefox/Firebug that after the server restar= ts, the client does get a new JSESSIONID value, which is then sent back to = the server with subsequent requests. =A0It doesn't surprise me that the cli= ent doesn't get messages after the broker restarts, since I expect the clie= nt needs to re-send the 'listen' POST. =A0But why a simple refresh doesn't = achieve this, I don't know. >> >> I'm seeing similar behavior if I view data via ajax, then leave that web= page for some amount of time (not sure what the time is, still trying to p= in it down more precisely), and then visit the page again. =A0The first tim= e I load the page after a prolonged absence, I don't get any data. =A0Ajax = GET & POST requests are made, and activemq responds with empty messages, though there are messages being published to the topic. =A0 N= o data is received until I refresh the browser. >> >> I don't know much about continuations, but could they be involved with t= his problem? >> >> thanks, >> alex > >