activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Rose <>
Subject ajax handling fast messages
Date Fri, 10 Dec 2010 17:06:53 GMT
  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


  <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});
<div id="results">

var amq = org.activemq.Amq;

Test = function() {
  return {
    init: function() {
      res = jQuery("#results");
      amq.addListener("result-handler", "topic://",
        function(msg) {
          console.log("msg: " + msg.getAttribute('num'));
          res.append("<p>["+msg.getAttribute('num')+"] ");
        {selector: "identifier='123'"});


for ($i=0; $i < 10; $i++) {
    "<result type='foo' num='".$i."'>test message: ".$i."</result>",
    array("identifier" => '123', 'persistent' => 'true'));

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