Author: gregw
Date: Fri Jun 23 01:53:23 2006
New Revision: 416640

URL: http://svn.apache.org/viewvc?rev=416640&view=rev
Log:
added optional poll delay to amq.js

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=416640&r1=416639&r2=416640&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
 Fri Jun 23 01:53:23 2006
@@ -12,6 +12,10 @@
 
   // Polling. Set to true (default) if waiting poll for messages is needed
   poll: true,
+  
+  // Poll delay. if set to positive integer, this is the time to wait in ms 
before
+  // sending the next poll after the last completes.
+  _pollDelay: 0,
 
   _first: true,
   _pollEvent: function(first) {},
@@ -96,8 +100,15 @@
     }
     amq.endBatch();
 
+    if (amq._pollDelay>0)
+      setTimeout('amq._sendPoll()',amq._pollDelay);
+    else
+      amq._sendPoll();
+  },
+  
+  _sendPoll: function(request)
+  {
     new Ajax.Request(amq.uri, { method: 'get', onSuccess: amq._pollHandler });
-    
   },
 
   // Add a function that gets called on every poll response, after all received
@@ -117,7 +128,7 @@
   // xml content.
   sendMessage : function(destination,message)
   {
-   amq._sendMessage(destination,message,'send');
+    amq._sendMessage(destination,message,'send');
   },
 
   // Listen on a channel or topic.   handler must be a function taking a 
message arguement


Reply via email to