You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by chago <na...@visualxs.com> on 2007/08/27 19:45:04 UTC
ActiveMQ, AJAX and polling timeout value
I'm a bit confused by the line in _amq.js that initiates the long poll to the
server (Jetty 6.1.4 using continuations in my particular case.)
_startPolling : function() {
if (amq.poll)
new Ajax.Request(amq.uri, {
method: 'get',
parameters: 'timeout=0',
onSuccess: amq._pollHandler });
}
Tracing the code into MessageListenerServlet, it seems like this request
would cause an infinite wait to occur when continuation.suspend(timeout); is
reached. A timeout value of 0 implies an infinite wait.
I see the infinite wait when I run the Jetty 6.1.4 and ActiveMQ 5 SNAPSHOT
from my IDE, however when I run the activemq-web-demo module using maven,
the get request with a timeout of 0 returns immediately with an envelope
with no messages.
I'm confused by the different behaviors, and I can only debug into the code
that I launch from inside my IDE. I'm not sure how to remote debug from a
maven-launched app, but I will continue to look into this.
Any thoughts?
--
View this message in context: http://www.nabble.com/ActiveMQ%2C-AJAX-and-polling-timeout-value-tf4337238s2354.html#a12354159
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
Re: ActiveMQ, AJAX and polling timeout value
Posted by chago <na...@visualxs.com>.
It appears that the difference lies in the fact that my maven config was
running version 6.1.4 of Jetty, while I was using version 6.1.5 in my IDE
debug session. When I downgraded to Jetty 6.1.4, the call made by the
_amq.js file returned immediately with an empty XML response.
With that said, I'm not sure which is the desired behavior. Perhaps GregW
can weigh in here. I'm not exactly sure why _amq.js is set up to invoke:
new Ajax.Request(amq.uri, {
method: 'get',
parameters: 'timeout=0',
onSuccess: amq._pollHandler
});
Why a hard-coded timeout=0?
Jetty 6.1.5 treats continuation.suspend(0) as an indefinite suspend; at
least until there is a message to send. For some reason in Jetty 6.1.4,
continuation.suspend(0) resumes immediately.
Any light that can be shed on the 'timeout=0' and the differences in how
Jetty handles it would be appreciated.
--
View this message in context: http://www.nabble.com/ActiveMQ%2C-AJAX-and-polling-timeout-value-tf4337238s2354.html#a12360913
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.