You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Jeff Rose <je...@globalorange.nl> on 2010/12/10 18:06:53 UTC
ajax handling fast messages
Hi,
Based on the ajax chat example I've put together a small test page to
display messages that I post to a topic or queue using a php script. When I
send 10 messages in a for loop from PHP then the ajax handler is only
getting called with a couple of the messages though. Looking at ActiveMQ
with jconsole I can see that all of the messages are getting taken off the
queue, but they don't all get to the browser. Do I need to do something
special in order to make sure I get all of the messages?
The relevant code is posted below. Any thoughts or advice would be
appreciated.
Thanks,
Jeff
----------------------
<html>
<head>
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/amq_jquery_adapter.js"></script>
<script type="text/javascript" src="js/amq.js"></script>
<script type="text/javascript" src="js/test.js"></script>
<script type="text/javascript">
jQuery(function() {
org.activemq.Amq.init({ uri: 'amq',
logging: true,
timeout: 60,
clientId: 2});
Test.init();
});
</script>
</head>
<body>
Results:
<div id="results">
</div>
</body>
</html>
------------------------------------------
var amq = org.activemq.Amq;
Test = function() {
return {
init: function() {
res = jQuery("#results");
amq.addListener("result-handler", "topic://flight.search.result",
function(msg) {
console.log("msg: " + msg.getAttribute('num'));
res.append("<p>["+msg.getAttribute('num')+"] ");
res.append(msg.childNodes[0].data+"</p>");
},
{selector: "identifier='123'"});
}
}
}();
-----------------------------------------
for ($i=0; $i < 10; $i++) {
$con->send("/topic/flight.search.result",
"<result type='foo' num='".$i."'>test message: ".$i."</result>",
array("identifier" => '123', 'persistent' => 'true'));
}
Re: ajax handling fast messages
Posted by Alex Dean <al...@crackpot.org>.
On Mar 6, 2011, at 7:13 PM, alikic wrote:
>
> alikic wrote:
>>
>> I hit this issue (AMQ-3094) with 5.4.2. Thanks for the great work on
>> fixing it!
>>
>> Is there a way (and is it safe) to apply the fixes for AMQ-3094 to 5.4.2,
>> or is it better to just grab the latest snapshot from svn? Do you know if
>> 5.5 is coming out any time soon?
>>
>> Thanks,
>> Aleks
>>
> I just compiled a patch (a jar with only three classes from AMQ-3094), put
> it at the beginning of classpath, and it fixed the issue.
For my work, I built activemq-web-5.5-SNAPSHOT.jar containing this fix, and dropped it into a stock ActiveMQ 5.4.2 build. We have not observed any ill effects using this combination so far.
alex
Re: ajax handling fast messages
Posted by alikic <al...@rogers.com>.
alikic wrote:
>
> I hit this issue (AMQ-3094) with 5.4.2. Thanks for the great work on
> fixing it!
>
> Is there a way (and is it safe) to apply the fixes for AMQ-3094 to 5.4.2,
> or is it better to just grab the latest snapshot from svn? Do you know if
> 5.5 is coming out any time soon?
>
> Thanks,
> Aleks
>
I just compiled a patch (a jar with only three classes from AMQ-3094), put
it at the beginning of classpath, and it fixed the issue.
--
View this message in context: http://activemq.2283324.n4.nabble.com/ajax-handling-fast-messages-tp3082334p3338264.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: ajax handling fast messages
Posted by alikic <al...@rogers.com>.
I hit this issue (AMQ-3094) with 5.4.2. Thanks for the great work on fixing
it!
Is there a way (and is it safe) to apply the fixes for AMQ-3094 to 5.4.2, or
is it better to just grab the latest snapshot from svn? Do you know if 5.5
is coming out any time soon?
Thanks,
Aleks
--
View this message in context: http://activemq.2283324.n4.nabble.com/ajax-handling-fast-messages-tp3082334p3337289.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: ajax handling fast messages
Posted by Alex Dean <al...@crackpot.org>.
On Jan 12, 2011, at 7:43 AM, Jeff Rose wrote:
> On Wed, Jan 12, 2011 at 12:29 AM, Alex Dean <al...@crackpot.org> wrote:
>
>>
>> On Jan 11, 2011, at 8:14 AM, Jeff Rose wrote:
>>
>>> On Mon, Jan 10, 2011 at 4:57 PM, Alex Dean <al...@crackpot.org> wrote:
>>>
>>>>
>>>> On Jan 10, 2011, at 5:02 AM, Jeff Rose wrote:
>>>>
>>>
>>> The last issue I do see is that fairly often the consumer stops listening
>> to
>>> the topic even though the ajax poll requests are still coming. I can see
>> in
>>> jconsole that the consumer count on my topic drops to zero, even though
>> at
>>> the same time I'm watching empty ajax responses coming back periodically.
>>
>> Hm. I've never seen that happen.
>>
>> Can you enable debug logging for activemq-web? I've been adding
>> log4j.logger.org.apache.activemq.web=DEBUG
>> to config/log4j.properties.
>>
>> When a new ajax client connects, you should see a line like:
>> DEBUG | creating new AjaxWebClient in
>> p8v92prp07trmhghrpltw0rh-1294788329515
>>
>> If you close the browser window and wait a minute, you should then see
>> something like:
>> DEBUG | Cleaning up expired web clients.
>> DEBUG | AjaxWebClient p8v92prp07trmhghrpltw0rh-1294788329515 last accessed
>> 95 seconds ago.
>> DEBUG | Removing expired AjaxWebClient
>> p8v92prp07trmhghrpltw0rh-1294788329515
>>
>> If you see a message like that 'Removing expired AjaxWebClient' while your
>> browser is still actively polling, that's wrong. Not sure what else might
>> cause the consumer count to drop back to 0.
>>
>> alex
>
>
> Below is a dump of the relevant log messages. Starting from the initial
> subscription when the first AJAX request is made. Then showing the 10
> messages sent by the test php script, which were correctly sent up to the
> browser. But after this first message batch arrived the consumer count in
> jconsole dropped to zero and no more messages made it. You can see that the
> GET long-poll requests keep coming, and it isn't expiring the client because
> it seems to be active. I'm not sure why the consumer is dropped though. I
> wonder if there could be an exception firing somewhere in the message
> processing that could result in this behavior?
>
> -Jeff
>
Hi Jeff. I haven't been able to reproduce that behavior. Does this happen every time, or intermittently? What do you see with a stock 5.4.2 build?
This is a shot in the dark, but I notice some log messages like
> DEBUG | [2] N-Messages: 1
... which I don't think are coming from ActiveMQ's trunk code or from my patch. Is it possible you've got other changes in the build you're testing?
alex
Re: ajax handling fast messages
Posted by Jeff Rose <je...@globalorange.nl>.
On Wed, Jan 12, 2011 at 12:29 AM, Alex Dean <al...@crackpot.org> wrote:
>
> On Jan 11, 2011, at 8:14 AM, Jeff Rose wrote:
>
> > On Mon, Jan 10, 2011 at 4:57 PM, Alex Dean <al...@crackpot.org> wrote:
> >
> >>
> >> On Jan 10, 2011, at 5:02 AM, Jeff Rose wrote:
> >>
> >
> > The last issue I do see is that fairly often the consumer stops listening
> to
> > the topic even though the ajax poll requests are still coming. I can see
> in
> > jconsole that the consumer count on my topic drops to zero, even though
> at
> > the same time I'm watching empty ajax responses coming back periodically.
>
> Hm. I've never seen that happen.
>
> Can you enable debug logging for activemq-web? I've been adding
> log4j.logger.org.apache.activemq.web=DEBUG
> to config/log4j.properties.
>
> When a new ajax client connects, you should see a line like:
> DEBUG | creating new AjaxWebClient in
> p8v92prp07trmhghrpltw0rh-1294788329515
>
> If you close the browser window and wait a minute, you should then see
> something like:
> DEBUG | Cleaning up expired web clients.
> DEBUG | AjaxWebClient p8v92prp07trmhghrpltw0rh-1294788329515 last accessed
> 95 seconds ago.
> DEBUG | Removing expired AjaxWebClient
> p8v92prp07trmhghrpltw0rh-1294788329515
>
> If you see a message like that 'Removing expired AjaxWebClient' while your
> browser is still actively polling, that's wrong. Not sure what else might
> cause the consumer count to drop back to 0.
>
> alex
Below is a dump of the relevant log messages. Starting from the initial
subscription when the first AJAX request is made. Then showing the 10
messages sent by the test php script, which were correctly sent up to the
browser. But after this first message batch arrived the consumer count in
jconsole dropped to zero and no more messages made it. You can see that the
GET long-poll requests keep coming, and it isn't expiring the client because
it seems to be active. I'm not sure why the consumer is dropped though. I
wonder if there could be an exception firing somewhere in the message
processing that could result in this behavior?
-Jeff
DEBUG | Subscribed: ActiveMQMessageConsumer {
value=ID:teak-39064-1294838564403-2:2:1:1, started=true } to
topic://flight.search.result id=result-handler
DEBUG | Cleaning up expired web clients.
DEBUG | AjaxWebClient 1xki1evjkyakl7di3kqfsqs5z-defaultAjaxWebClient last
accessed 3 seconds ago.
DEBUG | message for ActiveMQMessageConsumer {
value=ID:teak-39064-1294838564403-2:2:1:1, started=true
}continuation=org.eclipse.jetty.server.AsyncContinuation@184be29@ASYNCWAIT
DEBUG | message for ActiveMQMessageConsumer {
value=ID:teak-39064-1294838564403-2:2:1:1, started=true
}continuation=org.eclipse.jetty.server.AsyncContinuation@184be29
@REDISPATCHED,resumed
DEBUG | GET client=org.apache.activemq.web.AjaxWebClient@1685e30session=1xki1evjkyakl7di3kqfsqs5z
clientId=null uri=/demo/amq
query=timeout=60000&d=1294839231226&r=0.3835270793642849
DEBUG | doMessage timeout=25000
DEBUG | message for ActiveMQMessageConsumer {
value=ID:teak-39064-1294838564403-2:2:1:1, started=true
}continuation=org.eclipse.jetty.server.AsyncContinuation@184be29
@REDISPATCHED,resumed
DEBUG | message: ActiveMQTextMessage {commandId = 3, responseRequired =
false, messageId = ID:teak-39064-1294838564403-5:1:-1:1:1,
originalDestination = null, originalTransactionId = null, producerId =
ID:teak-39064-1294838564403-5:1:-1:1, destination =
topic://flight.search.result, transactionId = null, expiration = 0,
timestamp = 1294839245128, arrival = 0, brokerInTime = 1294839245129,
brokerOutTime = 1294839245133, correlationId = null, replyTo = null,
persistent = false, type = null, priority = 0, groupID = null, groupSequence
= 0, targetConsumerId = null, compressed = false, userID = null, content =
null, marshalledProperties = null, dataStructure = null, redeliveryCounter =
0, size = 1126, properties = {identifier=123}, readOnlyProperties = true,
readOnlyBody = true, droppable = false, text = <result type='foo'
num='0'>test message: 0</result>}
DEBUG | [2] N-Messages: 1
DEBUG | message: ActiveMQTextMessage {commandId = 4, responseRequired =
false, messageId = ID:teak-39064-1294838564403-5:1:-1:1:2,
originalDestination = null, originalTransactionId = null, producerId =
ID:teak-39064-1294838564403-5:1:-1:1, destination =
topic://flight.search.result, transactionId = null, expiration = 0,
timestamp = 1294839245133, arrival = 0, brokerInTime = 1294839245133,
brokerOutTime = 1294839245133, correlationId = null, replyTo = null,
persistent = false, type = null, priority = 0, groupID = null, groupSequence
= 0, targetConsumerId = null, compressed = false, userID = null, content =
null, marshalledProperties = null, dataStructure = null, redeliveryCounter =
0, size = 1126, properties = {identifier=123}, readOnlyProperties = true,
readOnlyBody = true, droppable = false, text = <result type='foo'
num='1'>test message: 1</result>}
DEBUG | [2] N-Messages: 2
DEBUG | message for ActiveMQMessageConsumer {
value=ID:teak-39064-1294838564403-2:2:1:1, started=true
}continuation=org.eclipse.jetty.server.AsyncContinuation@184be29
@REDISPATCHED,resumed
DEBUG | message: ActiveMQTextMessage {commandId = 5, responseRequired =
false, messageId = ID:teak-39064-1294838564403-5:1:-1:1:3,
originalDestination = null, originalTransactionId = null, producerId =
ID:teak-39064-1294838564403-5:1:-1:1, destination =
topic://flight.search.result, transactionId = null, expiration = 0,
timestamp = 1294839245133, arrival = 0, brokerInTime = 1294839245133,
brokerOutTime = 1294839245134, correlationId = null, replyTo = null,
persistent = false, type = null, priority = 0, groupID = null, groupSequence
= 0, targetConsumerId = null, compressed = false, userID = null, content =
null, marshalledProperties = null, dataStructure = null, redeliveryCounter =
0, size = 1126, properties = {identifier=123}, readOnlyProperties = true,
readOnlyBody = true, droppable = false, text = <result type='foo'
num='2'>test message: 2</result>}
DEBUG | [2] N-Messages: 3
DEBUG | message for ActiveMQMessageConsumer {
value=ID:teak-39064-1294838564403-2:2:1:1, started=true
}continuation=org.eclipse.jetty.server.AsyncContinuation@184be29
@REDISPATCHED,resumed
DEBUG | message: ActiveMQTextMessage {commandId = 6, responseRequired =
false, messageId = ID:teak-39064-1294838564403-5:1:-1:1:4,
originalDestination = null, originalTransactionId = null, producerId =
ID:teak-39064-1294838564403-5:1:-1:1, destination =
topic://flight.search.result, transactionId = null, expiration = 0,
timestamp = 1294839245133, arrival = 0, brokerInTime = 1294839245133,
brokerOutTime = 1294839245134, correlationId = null, replyTo = null,
persistent = false, type = null, priority = 0, groupID = null, groupSequence
= 0, targetConsumerId = null, compressed = false, userID = null, content =
null, marshalledProperties = null, dataStructure = null, redeliveryCounter =
0, size = 1126, properties = {identifier=123}, readOnlyProperties = true,
readOnlyBody = true, droppable = false, text = <result type='foo'
num='3'>test message: 3</result>}
DEBUG | [2] N-Messages: 4
DEBUG | message for ActiveMQMessageConsumer {
value=ID:teak-39064-1294838564403-2:2:1:1, started=true
}continuation=org.eclipse.jetty.server.AsyncContinuation@184be29
@REDISPATCHED,resumed
DEBUG | message for ActiveMQMessageConsumer {
value=ID:teak-39064-1294838564403-2:2:1:1, started=true
}continuation=org.eclipse.jetty.server.AsyncContinuation@184be29
@REDISPATCHED,resumed
DEBUG | message for ActiveMQMessageConsumer {
value=ID:teak-39064-1294838564403-2:2:1:1, started=true
}continuation=org.eclipse.jetty.server.AsyncContinuation@184be29
@REDISPATCHED,resumed
DEBUG | message: ActiveMQTextMessage {commandId = 7, responseRequired =
false, messageId = ID:teak-39064-1294838564403-5:1:-1:1:5,
originalDestination = null, originalTransactionId = null, producerId =
ID:teak-39064-1294838564403-5:1:-1:1, destination =
topic://flight.search.result, transactionId = null, expiration = 0,
timestamp = 1294839245135, arrival = 0, brokerInTime = 1294839245135,
brokerOutTime = 1294839245135, correlationId = null, replyTo = null,
persistent = false, type = null, priority = 0, groupID = null, groupSequence
= 0, targetConsumerId = null, compressed = false, userID = null, content =
null, marshalledProperties = null, dataStructure = null, redeliveryCounter =
0, size = 1126, properties = {identifier=123}, readOnlyProperties = true,
readOnlyBody = true, droppable = false, text = <result type='foo'
num='4'>test message: 4</result>}
DEBUG | [2] N-Messages: 5
DEBUG | message for ActiveMQMessageConsumer {
value=ID:teak-39064-1294838564403-2:2:1:1, started=true
}continuation=org.eclipse.jetty.server.AsyncContinuation@184be29
@REDISPATCHED,resumed
DEBUG | message for ActiveMQMessageConsumer {
value=ID:teak-39064-1294838564403-2:2:1:1, started=true
}continuation=org.eclipse.jetty.server.AsyncContinuation@184be29
@REDISPATCHED,resumed
DEBUG | message: ActiveMQTextMessage {commandId = 8, responseRequired =
false, messageId = ID:teak-39064-1294838564403-5:1:-1:1:6,
originalDestination = null, originalTransactionId = null, producerId =
ID:teak-39064-1294838564403-5:1:-1:1, destination =
topic://flight.search.result, transactionId = null, expiration = 0,
timestamp = 1294839245141, arrival = 0, brokerInTime = 1294839245141,
brokerOutTime = 1294839245144, correlationId = null, replyTo = null,
persistent = false, type = null, priority = 0, groupID = null, groupSequence
= 0, targetConsumerId = null, compressed = false, userID = null, content =
null, marshalledProperties = null, dataStructure = null, redeliveryCounter =
0, size = 1126, properties = {identifier=123}, readOnlyProperties = true,
readOnlyBody = true, droppable = false, text = <result type='foo'
num='5'>test message: 5</result>}
DEBUG | [2] N-Messages: 6
DEBUG | message: ActiveMQTextMessage {commandId = 9, responseRequired =
false, messageId = ID:teak-39064-1294838564403-5:1:-1:1:7,
originalDestination = null, originalTransactionId = null, producerId =
ID:teak-39064-1294838564403-5:1:-1:1, destination =
topic://flight.search.result, transactionId = null, expiration = 0,
timestamp = 1294839245142, arrival = 0, brokerInTime = 1294839245142,
brokerOutTime = 1294839245147, correlationId = null, replyTo = null,
persistent = false, type = null, priority = 0, groupID = null, groupSequence
= 0, targetConsumerId = null, compressed = false, userID = null, content =
null, marshalledProperties = null, dataStructure = null, redeliveryCounter =
0, size = 1126, properties = {identifier=123}, readOnlyProperties = true,
readOnlyBody = true, droppable = false, text = <result type='foo'
num='6'>test message: 6</result>}
DEBUG | [2] N-Messages: 7
DEBUG | message: ActiveMQTextMessage {commandId = 10, responseRequired =
false, messageId = ID:teak-39064-1294838564403-5:1:-1:1:8,
originalDestination = null, originalTransactionId = null, producerId =
ID:teak-39064-1294838564403-5:1:-1:1, destination =
topic://flight.search.result, transactionId = null, expiration = 0,
timestamp = 1294839245142, arrival = 0, brokerInTime = 1294839245142,
brokerOutTime = 1294839245147, correlationId = null, replyTo = null,
persistent = false, type = null, priority = 0, groupID = null, groupSequence
= 0, targetConsumerId = null, compressed = false, userID = null, content =
null, marshalledProperties = null, dataStructure = null, redeliveryCounter =
0, size = 1126, properties = {identifier=123}, readOnlyProperties = true,
readOnlyBody = true, droppable = false, text = <result type='foo'
num='7'>test message: 7</result>}
DEBUG | [2] N-Messages: 8
DEBUG | message: ActiveMQTextMessage {commandId = 11, responseRequired =
false, messageId = ID:teak-39064-1294838564403-5:1:-1:1:9,
originalDestination = null, originalTransactionId = null, producerId =
ID:teak-39064-1294838564403-5:1:-1:1, destination =
topic://flight.search.result, transactionId = null, expiration = 0,
timestamp = 1294839245142, arrival = 0, brokerInTime = 1294839245142,
brokerOutTime = 1294839245149, correlationId = null, replyTo = null,
persistent = false, type = null, priority = 0, groupID = null, groupSequence
= 0, targetConsumerId = null, compressed = false, userID = null, content =
null, marshalledProperties = null, dataStructure = null, redeliveryCounter =
0, size = 1126, properties = {identifier=123}, readOnlyProperties = true,
readOnlyBody = true, droppable = false, text = <result type='foo'
num='8'>test message: 8</result>}
DEBUG | [2] N-Messages: 9
DEBUG | message: ActiveMQTextMessage {commandId = 12, responseRequired =
false, messageId = ID:teak-39064-1294838564403-5:1:-1:1:10,
originalDestination = null, originalTransactionId = null, producerId =
ID:teak-39064-1294838564403-5:1:-1:1, destination =
topic://flight.search.result, transactionId = null, expiration = 0,
timestamp = 1294839245142, arrival = 0, brokerInTime = 1294839245142,
brokerOutTime = 1294839245150, correlationId = null, replyTo = null,
persistent = false, type = null, priority = 0, groupID = null, groupSequence
= 0, targetConsumerId = null, compressed = false, userID = null, content =
null, marshalledProperties = null, dataStructure = null, redeliveryCounter =
0, size = 1126, properties = {identifier=123}, readOnlyProperties = true,
readOnlyBody = true, droppable = false, text = <result type='foo'
num='9'>test message: 9</result>}
DEBUG | [2] N-Messages: 10
DEBUG | message: null
DEBUG | GET client=org.apache.activemq.web.AjaxWebClient@1685e30session=1xki1evjkyakl7di3kqfsqs5z
clientId=null uri=/demo/amq
query=timeout=60000&d=1294839245166&r=0.3406089080963284
DEBUG | doMessage timeout=25000
DEBUG | GET client=org.apache.activemq.web.AjaxWebClient@1685e30session=1xki1evjkyakl7di3kqfsqs5z
clientId=null uri=/demo/amq
query=timeout=60000&d=1294839221335&r=0.34852462634444237
DEBUG | doMessage timeout=25000
DEBUG | GET client=org.apache.activemq.web.AjaxWebClient@1685e30session=1xki1evjkyakl7di3kqfsqs5z
clientId=null uri=/demo/amq
query=timeout=60000&d=1294839245166&r=0.3406089080963284
DEBUG | doMessage timeout=25000
DEBUG | GET client=org.apache.activemq.web.AjaxWebClient@1685e30session=1xki1evjkyakl7di3kqfsqs5z
clientId=null uri=/demo/amq
query=timeout=60000&d=1294839270172&r=0.10504370275884867
DEBUG | doMessage timeout=25000
DEBUG | Cleaning up expired web clients.
DEBUG | Cleaning up expired web clients.
DEBUG | AjaxWebClient 1xki1evjkyakl7di3kqfsqs5z-defaultAjaxWebClient last
accessed 24 seconds ago.
DEBUG | GET client=org.apache.activemq.web.AjaxWebClient@1685e30session=1xki1evjkyakl7di3kqfsqs5z
clientId=null uri=/demo/amq
query=timeout=60000&d=1294839270172&r=0.10504370275884867
DEBUG | doMessage timeout=25000
DEBUG | GET client=org.apache.activemq.web.AjaxWebClient@1685e30session=1xki1evjkyakl7di3kqfsqs5z
clientId=null uri=/demo/amq
query=timeout=60000&d=1294839295179&r=0.4715004425961524
DEBUG | doMessage timeout=25000
Re: ajax handling fast messages
Posted by Alex Dean <al...@crackpot.org>.
On Jan 11, 2011, at 8:14 AM, Jeff Rose wrote:
> On Mon, Jan 10, 2011 at 4:57 PM, Alex Dean <al...@crackpot.org> wrote:
>
>>
>> On Jan 10, 2011, at 5:02 AM, Jeff Rose wrote:
>>
>
> The last issue I do see is that fairly often the consumer stops listening to
> the topic even though the ajax poll requests are still coming. I can see in
> jconsole that the consumer count on my topic drops to zero, even though at
> the same time I'm watching empty ajax responses coming back periodically.
Hm. I've never seen that happen.
Can you enable debug logging for activemq-web? I've been adding
log4j.logger.org.apache.activemq.web=DEBUG
to config/log4j.properties.
When a new ajax client connects, you should see a line like:
DEBUG | creating new AjaxWebClient in p8v92prp07trmhghrpltw0rh-1294788329515
If you close the browser window and wait a minute, you should then see something like:
DEBUG | Cleaning up expired web clients.
DEBUG | AjaxWebClient p8v92prp07trmhghrpltw0rh-1294788329515 last accessed 95 seconds ago.
DEBUG | Removing expired AjaxWebClient p8v92prp07trmhghrpltw0rh-1294788329515
If you see a message like that 'Removing expired AjaxWebClient' while your browser is still actively polling, that's wrong. Not sure what else might cause the consumer count to drop back to 0.
alex
Re: ajax handling fast messages
Posted by Jeff Rose <je...@globalorange.nl>.
On Mon, Jan 10, 2011 at 4:57 PM, Alex Dean <al...@crackpot.org> wrote:
>
> On Jan 10, 2011, at 5:02 AM, Jeff Rose wrote:
>
> > On Sat, Jan 8, 2011 at 2:11 AM, Alex Dean <al...@crackpot.org> wrote:
> > On Dec 14, 2010, at 9:48 AM, Jeff Rose wrote:
> >
> > > Hi Alex,
> > > Thanks for the response. We looked into it a bit more based on your
> > > suggestion, and we discovered that there is an error occurring when the
> > > continuation is resumed in onMessageAvailable in AjaxListener.java. It
> > > looks like this onMessageAvailable handler is being called every time a
> new
> > > message arrives on the queue, and then it is trying to resume a
> continuation
> > > that has already been resumed, which causes an illegal state exception.
> > > We've been trying to fix the bug by checking first:
> > >
> > > !continuation.isResumed()
> > >
> > > but we are still getting the error occasionally (although it does often
> get
> > > all of the messages now). This seems to be a pretty fundamental bug in
> the
> > > AJAX support of ActiveMQ. Definitely worth posting a ticket (although
> I
> > > don't know where that is done).
> >
> > Jeff: I attached a patch to AMQ-3094 which I think fixes this problem. A
> continuation can be in more states than just initial & resumed, so checking
> !continuation.isResumed() can still result in illegal state exceptions. I
> changed your suggestion so AjaxListener only tries to resume a continuation
> "if( continuation.isSuspended() )". Otherwise it buffers the message for
> delivery in the next poll (building on some code Dejan committed a few days
> ago).
> >
> > Let me know if you have time to test this patch, and if it solves the
> issue for you. It looks good in my tests so far.
> >
> >
> https://issues.apache.org/jira/secure/attachment/12467757/all_messages_are_delivered_to_ajax_clients.patch
> >
> > Hi Alex,
> > I'm not able to apply your patch, either to the latest from SVN or to
> revision 1052368 which is specified in the patch. For example, in
> MessageListenerServlet.java I don't have any reference to the
> unconsumedMessages linked list. Can you generate the patch against the
> latest from SVN so I can give it a try? I've got everything setup again to
> test with my initial PHP and javascript configuration.
>
> Sure. I'll update to trunk HEAD and re-send the patch.
>
> unconsumedMessages was added to AjaxListener in r1052259, so if you've got
> HEAD you should have it.
> http://svn.apache.org/viewvc?view=revision&revision=1052259
>
> Updated patch (now based on trunk r1057227) is at
> https://issues.apache.org/jira/secure/attachment/12467892/all_messages_are_delivered_to_ajax_clients.2.patch
>
> alex
Nice, this is working much better. Now I can see that responses are
sometimes spread across multiple <ajax-response> elements, and I'm not
getting random dropped messages like before.
The last issue I do see is that fairly often the consumer stops listening to
the topic even though the ajax poll requests are still coming. I can see in
jconsole that the consumer count on my topic drops to zero, even though at
the same time I'm watching empty ajax responses coming back periodically.
-Jeff
Re: ajax handling fast messages
Posted by Alex Dean <al...@crackpot.org>.
On Jan 10, 2011, at 5:02 AM, Jeff Rose wrote:
> On Sat, Jan 8, 2011 at 2:11 AM, Alex Dean <al...@crackpot.org> wrote:
> On Dec 14, 2010, at 9:48 AM, Jeff Rose wrote:
>
> > Hi Alex,
> > Thanks for the response. We looked into it a bit more based on your
> > suggestion, and we discovered that there is an error occurring when the
> > continuation is resumed in onMessageAvailable in AjaxListener.java. It
> > looks like this onMessageAvailable handler is being called every time a new
> > message arrives on the queue, and then it is trying to resume a continuation
> > that has already been resumed, which causes an illegal state exception.
> > We've been trying to fix the bug by checking first:
> >
> > !continuation.isResumed()
> >
> > but we are still getting the error occasionally (although it does often get
> > all of the messages now). This seems to be a pretty fundamental bug in the
> > AJAX support of ActiveMQ. Definitely worth posting a ticket (although I
> > don't know where that is done).
>
> Jeff: I attached a patch to AMQ-3094 which I think fixes this problem. A continuation can be in more states than just initial & resumed, so checking !continuation.isResumed() can still result in illegal state exceptions. I changed your suggestion so AjaxListener only tries to resume a continuation "if( continuation.isSuspended() )". Otherwise it buffers the message for delivery in the next poll (building on some code Dejan committed a few days ago).
>
> Let me know if you have time to test this patch, and if it solves the issue for you. It looks good in my tests so far.
>
> https://issues.apache.org/jira/secure/attachment/12467757/all_messages_are_delivered_to_ajax_clients.patch
>
> Hi Alex,
> I'm not able to apply your patch, either to the latest from SVN or to revision 1052368 which is specified in the patch. For example, in MessageListenerServlet.java I don't have any reference to the unconsumedMessages linked list. Can you generate the patch against the latest from SVN so I can give it a try? I've got everything setup again to test with my initial PHP and javascript configuration.
Sure. I'll update to trunk HEAD and re-send the patch.
unconsumedMessages was added to AjaxListener in r1052259, so if you've got HEAD you should have it. http://svn.apache.org/viewvc?view=revision&revision=1052259
Updated patch (now based on trunk r1057227) is at https://issues.apache.org/jira/secure/attachment/12467892/all_messages_are_delivered_to_ajax_clients.2.patch
alex
Re: ajax handling fast messages
Posted by Jeff Rose <je...@globalorange.nl>.
On Sat, Jan 8, 2011 at 2:11 AM, Alex Dean <al...@crackpot.org> wrote:
> On Dec 14, 2010, at 9:48 AM, Jeff Rose wrote:
>
> > Hi Alex,
> > Thanks for the response. We looked into it a bit more based on your
> > suggestion, and we discovered that there is an error occurring when the
> > continuation is resumed in onMessageAvailable in AjaxListener.java. It
> > looks like this onMessageAvailable handler is being called every time a
> new
> > message arrives on the queue, and then it is trying to resume a
> continuation
> > that has already been resumed, which causes an illegal state exception.
> > We've been trying to fix the bug by checking first:
> >
> > !continuation.isResumed()
> >
> > but we are still getting the error occasionally (although it does often
> get
> > all of the messages now). This seems to be a pretty fundamental bug in
> the
> > AJAX support of ActiveMQ. Definitely worth posting a ticket (although I
> > don't know where that is done).
>
> Jeff: I attached a patch to AMQ-3094 which I think fixes this problem. A
> continuation can be in more states than just initial & resumed, so checking
> !continuation.isResumed() can still result in illegal state exceptions. I
> changed your suggestion so AjaxListener only tries to resume a continuation
> "if( continuation.isSuspended() )". Otherwise it buffers the message for
> delivery in the next poll (building on some code Dejan committed a few days
> ago).
>
> Let me know if you have time to test this patch, and if it solves the issue
> for you. It looks good in my tests so far.
>
>
> https://issues.apache.org/jira/secure/attachment/12467757/all_messages_are_delivered_to_ajax_clients.patch
Hi Alex,
I'm not able to apply your patch, either to the latest from SVN or to
revision 1052368 which is specified in the patch. For example,
in MessageListenerServlet.java I don't have any reference to
the unconsumedMessages linked list. Can you generate the patch against the
latest from SVN so I can give it a try? I've got everything setup again to
test with my initial PHP and javascript configuration.
Thanks,
Jeff
Re: ajax handling fast messages
Posted by Alex Dean <al...@crackpot.org>.
On Dec 14, 2010, at 9:48 AM, Jeff Rose wrote:
> Hi Alex,
> Thanks for the response. We looked into it a bit more based on your
> suggestion, and we discovered that there is an error occurring when the
> continuation is resumed in onMessageAvailable in AjaxListener.java. It
> looks like this onMessageAvailable handler is being called every time a new
> message arrives on the queue, and then it is trying to resume a continuation
> that has already been resumed, which causes an illegal state exception.
> We've been trying to fix the bug by checking first:
>
> !continuation.isResumed()
>
> but we are still getting the error occasionally (although it does often get
> all of the messages now). This seems to be a pretty fundamental bug in the
> AJAX support of ActiveMQ. Definitely worth posting a ticket (although I
> don't know where that is done).
Jeff: I attached a patch to AMQ-3094 which I think fixes this problem. A continuation can be in more states than just initial & resumed, so checking !continuation.isResumed() can still result in illegal state exceptions. I changed your suggestion so AjaxListener only tries to resume a continuation "if( continuation.isSuspended() )". Otherwise it buffers the message for delivery in the next poll (building on some code Dejan committed a few days ago).
Let me know if you have time to test this patch, and if it solves the issue for you. It looks good in my tests so far.
https://issues.apache.org/jira/secure/attachment/12467757/all_messages_are_delivered_to_ajax_clients.patch
alex
Re: ajax handling fast messages
Posted by Alex Dean <al...@crackpot.org>.
Dejan : Saw your commits in https://issues.apache.org/jira/browse/AMQ-3094. When I publish many messages quickly (either via Ruby/stomp or via ajax), I still do not receive all messages in an ajax client. I have been trying to get a Java test case created which reproduces the problem. I suspect it's an issue with continuations, since all the Java tests I write (which are all currently passing) are running synchronously. Still not able to reproduce the issue in a single junit test.
org.eclipse.jetty.client.HttpClient offers some nice methods for dealing with async i/o, which would be useful here. But i had trouble getting session/cookie management using that class. As you pointed out a while ago, org.apache.commons.httpclient.HttpClient has automatic session handling, but I'm not finding the same features for handling async requests, which it seems like we need to reproduce the current problem.
I'm trying to write a test where
- Thread 1 starts a subscription & polls for messages
- Thread 2 publishes a lot of messages while thread 1's poll is active
I think we'll see that not all messages sent by thread 2 are received in thread 1.
alex
Re: ajax handling fast messages
Posted by Alex Dean <al...@crackpot.org>.
On Dec 17, 2010, at 1:14 PM, Alex Dean wrote:
>
> On Dec 16, 2010, at 5:33 PM, Alex Dean wrote:
>
>>
>> I'll get a useful test written up tomorrow morning, and create a new JIRA issue if Jeff doesn't beat me to it.
>
> I've created https://issues.apache.org/jira/browse/AMQ-3094 for this problem.
>
> My testing so far is inconsistent. If I publish 5 messages quickly via JavaScript, then a separate JavaScript client sometimes receives 1 of the messages, and sometimes two of them.
>
> If I publish 3 messages in a JUnit test, my http client can either receive 0 messages or all 3 messages. That's after re-running the same tests multiple times, with no code changes inbetween test runs. Sometimes I get messages, and sometimes I don't.
>
> JavaScript & Java test files & sample output are attached to the ticket. I don't feel like I'm any closer to a solution, but hopefully this helps others reproduce the issue.
I think the issue may be that AjaxListener's constructor does not set an initial value for lastAccess. By setting "this.lastAccess = System.currentTimeMillis();" in the constructor, my test always pass. I want to do more testing, since I don't have very good test coverage yet, but this seems promising.
One question for the core guys... Why does the code always surround debugging log statements with an if()?
if (LOG.isDebugEnabled()) {
LOG.debug( "blah" );
}
Is it OK to just call "LOG.debug()" without the if()?
alex
Re: ajax handling fast messages
Posted by Alex Dean <al...@crackpot.org>.
On Dec 16, 2010, at 5:33 PM, Alex Dean wrote:
>
> I'll get a useful test written up tomorrow morning, and create a new JIRA issue if Jeff doesn't beat me to it.
I've created https://issues.apache.org/jira/browse/AMQ-3094 for this problem.
My testing so far is inconsistent. If I publish 5 messages quickly via JavaScript, then a separate JavaScript client sometimes receives 1 of the messages, and sometimes two of them.
If I publish 3 messages in a JUnit test, my http client can either receive 0 messages or all 3 messages. That's after re-running the same tests multiple times, with no code changes inbetween test runs. Sometimes I get messages, and sometimes I don't.
JavaScript & Java test files & sample output are attached to the ticket. I don't feel like I'm any closer to a solution, but hopefully this helps others reproduce the issue.
alex
Re: ajax handling fast messages
Posted by Alex Dean <al...@crackpot.org>.
On Dec 15, 2010, at 9:34 AM, Dejan Bosanac wrote:
> Hey Alex,
>
> seems like http client should this job automatically
>
> http://hc.apache.org/httpclient-3.x/cookies.html
>
> did you try some of this methods?
I thought I had. I was using RestTest.java as a model.
Your link helped me realize that org.eclipse.jetty.client.HttpClient (as used in RestTest) is a totally different animal from org.apache.commons.httpclient.HttpClient. I have never been able to get cookie handling to work with the Jetty HttpClient, but apache commons one worked as you'd expect. Cookie handling is transparent, and my GET (to poll for messages) uses the same session as my initial POST (to create a subscription).
I'll get a useful test written up tomorrow morning, and create a new JIRA issue if Jeff doesn't beat me to it.
>
> btw. thanks for the effort of creating a test case.
No problem. We're getting a lot of benefit out of ActiveMQ, and it's great to be able to help out.
alex
Re: ajax handling fast messages
Posted by Dejan Bosanac <de...@nighttale.net>.
Hey Alex,
seems like http client should this job automatically
http://hc.apache.org/httpclient-3.x/cookies.html
did you try some of this methods?
btw. thanks for the effort of creating a test case.
Cheers
--
Dejan Bosanac
-----------------
FuseSource - The experts in open source integration and messaging.
Email: dejanb@fusesource.com
Web: http://fusesource.com
Twitter: http://twitter.com/dejanb
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net
On Wed, Dec 15, 2010 at 3:46 PM, Alex Dean <al...@crackpot.org> wrote:
> On Dec 15, 2010, at 3:02 AM, Dejan Bosanac wrote:
>
>> Hi Jeff, Alex,
>>
>> having some kind of test that reproduces the issue would be great.
>> It'd be good to add something to the tests Alex already contributed
>>
>> https://fisheye6.atlassian.com/browse/activemq/trunk/activemq-web-demo/src/main/webapp/test/amq_test.html?r=HEAD
>>
>
>
> These tests will be junit, since they're testing MessageListenerServlet. The trouble I've had in the past, and continue to have, is that I haven't been able to get the session cookie returned during my tests.
>
> Here's a test I've worked on : http://pastie.org/1177995
> Here's the output : http://pastie.org/1178030
>
> This code shows 2 separate ways I've tried accessing the response headers.
> 1. Implementing ContentExchange.onResponseHeader. My callback is never called, though my other onRequestComplete and onResponseComplete callbacks are.
> 2. Trying to use ContentExchange.getResponseFields(). The returned object is null.
>
> I watched port 8080 in wireshark while my test was running, and I did see that the 'Set-Cookie' header was returned by the server.
> http://skitch.com/alexdean/d2g2b/capturing-from-lo0-wireshark
>
> I am able to send a POST to the servlet, and I do receive a response, but without the cookie I can't associate my later requests with the subscriptions I've created in the initial POST.
>
> If anyone can see what I'm doing wrong, I'd really appreciate some tips or even a nudge in the right direction. If I could get this working, I could write a test pretty easily to reproduce the issue we're currently seeing, and then verify the issue has been fixed. I could also write tests for the previous patches I've submitted for MessageListenerServlet.
>
> thanks,
> alex
Re: ajax handling fast messages
Posted by Alex Dean <al...@crackpot.org>.
On Dec 15, 2010, at 3:02 AM, Dejan Bosanac wrote:
> Hi Jeff, Alex,
>
> having some kind of test that reproduces the issue would be great.
> It'd be good to add something to the tests Alex already contributed
>
> https://fisheye6.atlassian.com/browse/activemq/trunk/activemq-web-demo/src/main/webapp/test/amq_test.html?r=HEAD
>
These tests will be junit, since they're testing MessageListenerServlet. The trouble I've had in the past, and continue to have, is that I haven't been able to get the session cookie returned during my tests.
Here's a test I've worked on : http://pastie.org/1177995
Here's the output : http://pastie.org/1178030
This code shows 2 separate ways I've tried accessing the response headers.
1. Implementing ContentExchange.onResponseHeader. My callback is never called, though my other onRequestComplete and onResponseComplete callbacks are.
2. Trying to use ContentExchange.getResponseFields(). The returned object is null.
I watched port 8080 in wireshark while my test was running, and I did see that the 'Set-Cookie' header was returned by the server.
http://skitch.com/alexdean/d2g2b/capturing-from-lo0-wireshark
I am able to send a POST to the servlet, and I do receive a response, but without the cookie I can't associate my later requests with the subscriptions I've created in the initial POST.
If anyone can see what I'm doing wrong, I'd really appreciate some tips or even a nudge in the right direction. If I could get this working, I could write a test pretty easily to reproduce the issue we're currently seeing, and then verify the issue has been fixed. I could also write tests for the previous patches I've submitted for MessageListenerServlet.
thanks,
alex
Re: ajax handling fast messages
Posted by Dejan Bosanac <de...@nighttale.net>.
Hi Jeff, Alex,
having some kind of test that reproduces the issue would be great.
It'd be good to add something to the tests Alex already contributed
https://fisheye6.atlassian.com/browse/activemq/trunk/activemq-web-demo/src/main/webapp/test/amq_test.html?r=HEAD
Cheers
--
Dejan Bosanac
-----------------
FuseSource - The experts in open source integration and messaging.
Email: dejanb@fusesource.com
Web: http://fusesource.com
Twitter: http://twitter.com/dejanb
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net
On Tue, Dec 14, 2010 at 7:17 PM, Alex Dean <al...@crackpot.org> wrote:
> Hi Jeff. That's great news. I'm not very Java-savvy, but I've made a few patches to the activemq ajax code in the past. I've spent a bit of time lately trying to get junit test cases working for testing MessageListenerServlet, so I haven't actually made much progress in solving the issue at hand. If you've found the error, that's fantastic. Can you post your patch?
>
> To get a ticket reported, use https://issues.apache.org/jira/secure/CreateIssue!default.jspa. You'll need to register before you can open an issue. If you can attach a patch, I will happily contribute to the testing effort.
>
> alex
>
> On Dec 14, 2010, at 10:48 AM, Jeff Rose wrote:
>
>> Hi Alex,
>> Thanks for the response. We looked into it a bit more based on your
>> suggestion, and we discovered that there is an error occurring when the
>> continuation is resumed in onMessageAvailable in AjaxListener.java. It
>> looks like this onMessageAvailable handler is being called every time a new
>> message arrives on the queue, and then it is trying to resume a continuation
>> that has already been resumed, which causes an illegal state exception.
>> We've been trying to fix the bug by checking first:
>>
>> !continuation.isResumed()
>>
>> but we are still getting the error occasionally (although it does often get
>> all of the messages now). This seems to be a pretty fundamental bug in the
>> AJAX support of ActiveMQ. Definitely worth posting a ticket (although I
>> don't know where that is done).
>>
>> -Jeff
>>
>>
>> On Fri, Dec 10, 2010 at 6:33 PM, Alex Dean <al...@crackpot.org> wrote:
>>
>>>
>>> On Dec 10, 2010, at 11:06 AM, Jeff Rose wrote:
>>>
>>>> Hi,
>>>> Based on the ajax chat example I've put together a small test page to
>>>> display messages that I post to a topic or queue using a php script.
>>> When I
>>>> send 10 messages in a for loop from PHP then the ajax handler is only
>>>> getting called with a couple of the messages though. Looking at ActiveMQ
>>>> with jconsole I can see that all of the messages are getting taken off
>>> the
>>>> queue, but they don't all get to the browser. Do I need to do something
>>>> special in order to make sure I get all of the messages?
>>>>
>>>> The relevant code is posted below. Any thoughts or advice would be
>>>> appreciated.
>>>
>>> I've noticed the same issue recently. If I publish 5 messages via a
>>> ruby+stomp publisher, I receive all 5 in a ruby+stomp consumer, but I only
>>> see 1 message in a javascript/ajax consumer. The <ajax-response> XML element
>>> always has only a single <response> element. (I can see this in Firebug.)
>>> The admin webapp shows that all my messages are being de-queued, so I think
>>> the ajax servlet is picking up the messages but failing to deliver them to
>>> the browser.
>>>
>>> Just this morning I was poking around in the code trying to see what's
>>> going on. I have a guess it's in MessageListenterServelet.doMessages().
>>> There's some code in there which should put multiple <response> elements
>>> into a single <ajax-response>, but it's not happening for some reason.
>>>
>>> Maybe we should open a ticket for this?
>>>
>>> alex
>
>
Re: ajax handling fast messages
Posted by Alex Dean <al...@crackpot.org>.
Hi Jeff. That's great news. I'm not very Java-savvy, but I've made a few patches to the activemq ajax code in the past. I've spent a bit of time lately trying to get junit test cases working for testing MessageListenerServlet, so I haven't actually made much progress in solving the issue at hand. If you've found the error, that's fantastic. Can you post your patch?
To get a ticket reported, use https://issues.apache.org/jira/secure/CreateIssue!default.jspa. You'll need to register before you can open an issue. If you can attach a patch, I will happily contribute to the testing effort.
alex
On Dec 14, 2010, at 10:48 AM, Jeff Rose wrote:
> Hi Alex,
> Thanks for the response. We looked into it a bit more based on your
> suggestion, and we discovered that there is an error occurring when the
> continuation is resumed in onMessageAvailable in AjaxListener.java. It
> looks like this onMessageAvailable handler is being called every time a new
> message arrives on the queue, and then it is trying to resume a continuation
> that has already been resumed, which causes an illegal state exception.
> We've been trying to fix the bug by checking first:
>
> !continuation.isResumed()
>
> but we are still getting the error occasionally (although it does often get
> all of the messages now). This seems to be a pretty fundamental bug in the
> AJAX support of ActiveMQ. Definitely worth posting a ticket (although I
> don't know where that is done).
>
> -Jeff
>
>
> On Fri, Dec 10, 2010 at 6:33 PM, Alex Dean <al...@crackpot.org> wrote:
>
>>
>> On Dec 10, 2010, at 11:06 AM, Jeff Rose wrote:
>>
>>> Hi,
>>> Based on the ajax chat example I've put together a small test page to
>>> display messages that I post to a topic or queue using a php script.
>> When I
>>> send 10 messages in a for loop from PHP then the ajax handler is only
>>> getting called with a couple of the messages though. Looking at ActiveMQ
>>> with jconsole I can see that all of the messages are getting taken off
>> the
>>> queue, but they don't all get to the browser. Do I need to do something
>>> special in order to make sure I get all of the messages?
>>>
>>> The relevant code is posted below. Any thoughts or advice would be
>>> appreciated.
>>
>> I've noticed the same issue recently. If I publish 5 messages via a
>> ruby+stomp publisher, I receive all 5 in a ruby+stomp consumer, but I only
>> see 1 message in a javascript/ajax consumer. The <ajax-response> XML element
>> always has only a single <response> element. (I can see this in Firebug.)
>> The admin webapp shows that all my messages are being de-queued, so I think
>> the ajax servlet is picking up the messages but failing to deliver them to
>> the browser.
>>
>> Just this morning I was poking around in the code trying to see what's
>> going on. I have a guess it's in MessageListenterServelet.doMessages().
>> There's some code in there which should put multiple <response> elements
>> into a single <ajax-response>, but it's not happening for some reason.
>>
>> Maybe we should open a ticket for this?
>>
>> alex
Re: ajax handling fast messages
Posted by Jeff Rose <je...@globalorange.nl>.
Hi Alex,
Thanks for the response. We looked into it a bit more based on your
suggestion, and we discovered that there is an error occurring when the
continuation is resumed in onMessageAvailable in AjaxListener.java. It
looks like this onMessageAvailable handler is being called every time a new
message arrives on the queue, and then it is trying to resume a continuation
that has already been resumed, which causes an illegal state exception.
We've been trying to fix the bug by checking first:
!continuation.isResumed()
but we are still getting the error occasionally (although it does often get
all of the messages now). This seems to be a pretty fundamental bug in the
AJAX support of ActiveMQ. Definitely worth posting a ticket (although I
don't know where that is done).
-Jeff
On Fri, Dec 10, 2010 at 6:33 PM, Alex Dean <al...@crackpot.org> wrote:
>
> On Dec 10, 2010, at 11:06 AM, Jeff Rose wrote:
>
> > Hi,
> > Based on the ajax chat example I've put together a small test page to
> > display messages that I post to a topic or queue using a php script.
> When I
> > send 10 messages in a for loop from PHP then the ajax handler is only
> > getting called with a couple of the messages though. Looking at ActiveMQ
> > with jconsole I can see that all of the messages are getting taken off
> the
> > queue, but they don't all get to the browser. Do I need to do something
> > special in order to make sure I get all of the messages?
> >
> > The relevant code is posted below. Any thoughts or advice would be
> > appreciated.
>
> I've noticed the same issue recently. If I publish 5 messages via a
> ruby+stomp publisher, I receive all 5 in a ruby+stomp consumer, but I only
> see 1 message in a javascript/ajax consumer. The <ajax-response> XML element
> always has only a single <response> element. (I can see this in Firebug.)
> The admin webapp shows that all my messages are being de-queued, so I think
> the ajax servlet is picking up the messages but failing to deliver them to
> the browser.
>
> Just this morning I was poking around in the code trying to see what's
> going on. I have a guess it's in MessageListenterServelet.doMessages().
> There's some code in there which should put multiple <response> elements
> into a single <ajax-response>, but it's not happening for some reason.
>
> Maybe we should open a ticket for this?
>
> alex
Re: ajax handling fast messages
Posted by Alex Dean <al...@crackpot.org>.
On Dec 10, 2010, at 11:06 AM, Jeff Rose wrote:
> Hi,
> Based on the ajax chat example I've put together a small test page to
> display messages that I post to a topic or queue using a php script. When I
> send 10 messages in a for loop from PHP then the ajax handler is only
> getting called with a couple of the messages though. Looking at ActiveMQ
> with jconsole I can see that all of the messages are getting taken off the
> queue, but they don't all get to the browser. Do I need to do something
> special in order to make sure I get all of the messages?
>
> The relevant code is posted below. Any thoughts or advice would be
> appreciated.
I've noticed the same issue recently. If I publish 5 messages via a ruby+stomp publisher, I receive all 5 in a ruby+stomp consumer, but I only see 1 message in a javascript/ajax consumer. The <ajax-response> XML element always has only a single <response> element. (I can see this in Firebug.) The admin webapp shows that all my messages are being de-queued, so I think the ajax servlet is picking up the messages but failing to deliver them to the browser.
Just this morning I was poking around in the code trying to see what's going on. I have a guess it's in MessageListenterServelet.doMessages(). There's some code in there which should put multiple <response> elements into a single <ajax-response>, but it's not happening for some reason.
Maybe we should open a ticket for this?
alex