Author: gregw
Date: Thu Jun 22 03:38:19 2006
New Revision: 416324

URL: http://svn.apache.org/viewvc?rev=416324&view=rev
Log:
only have a single outstanding send to avoid out of order messaging. improved 
batching

Modified:
    
incubator/activemq/trunk/activemq-web/src/main/resources/org/apache/activemq/web/_amq.js

Modified: 
incubator/activemq/trunk/activemq-web/src/main/resources/org/apache/activemq/web/_amq.js
URL: 
http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-web/src/main/resources/org/apache/activemq/web/_amq.js?rev=416324&r1=416323&r2=416324&view=diff
==============================================================================
--- 
incubator/activemq/trunk/activemq-web/src/main/resources/org/apache/activemq/web/_amq.js
 (original)
+++ 
incubator/activemq/trunk/activemq-web/src/main/resources/org/apache/activemq/web/_amq.js
 Thu Jun 22 03:38:19 2006
@@ -76,13 +76,14 @@
       var body = amq._messageQueue;
       amq._messageQueue='';
       amq._messages=0;
-      new Ajax.Request(amq.uri, { method: 'post', postBody: body});
+      amq._queueMessages++;
+      new Ajax.Request(amq.uri, { method: 'post', postBody: body, onSuccess: 
amq.endBatch});
     }
   },
 
   _pollHandler: function(request)
   {
-    amq._queueMessages++;
+    amq.startBatch();
     try
     {
       amq._messageHandler(request);
@@ -93,20 +94,10 @@
     {
         alert(e);
     }
+    amq.endBatch();
 
-    amq._queueMessages--;
-
-    if (amq._queueMessages==0 && amq._messages>0)
-    {
-      var body = amq._messageQueue+'&poll='+amq.poll;
-      amq._messageQueue='';
-      amq._messages=0;
-      new Ajax.Request(amq.uri, { method: 'post', onSuccess: amq._pollHandler, 
postBody: body });
-    }
-    else if (amq.poll)
-    {
-        new Ajax.Request(amq.uri, { method: 'get', onSuccess: amq._pollHandler 
});
-    }
+    new Ajax.Request(amq.uri, { method: 'get', onSuccess: amq._pollHandler });
+    
   },
 
   // Add a function that gets called on every poll response, after all received
@@ -153,19 +144,20 @@
       }
       else
       {
-        
amq._messageQueue='d'+amq._messages+'='+destination+'&m'+amq._messages+'='+message+'&t'+amq._messages+'='+type;
+        
amq._messageQueue+='&d'+amq._messages+'='+destination+'&m'+amq._messages+'='+message+'&t'+amq._messages+'='+type;
       }
       amq._messages++;
     }
     else
     {
-      new Ajax.Request(amq.uri, { method: 'post', postBody: 
'destination='+destination+'&message='+message+'&type='+type});
+      amq.startBatch();
+      new Ajax.Request(amq.uri, { method: 'post', postBody: 
'destination='+destination+'&message='+message+'&type='+type, onSuccess: 
amq.endBatch});
     }
   },
-
+  
   _startPolling : function()
   {
-    if (amq.poll)
+   if (amq.poll)
       new Ajax.Request(amq.uri, { method: 'get', parameters: 'timeout=0', 
onSuccess: amq._pollHandler });
   }
 };


Reply via email to