added optional poll delay to amq.js

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@416640 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gregory John Wilkins 2006-06-23 08:53:23 +00:00
parent 6a794d8a60
commit 990b852b42
1 changed files with 13 additions and 2 deletions

View File

@ -12,6 +12,10 @@ var amq =
// 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 @@ var amq =
}
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 @@ var amq =
// 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