activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ken Seiss (JIRA)" <j...@apache.org>
Subject [jira] [Created] (AMQ-3350) amq.js initHandler() method swallows first message received
Date Thu, 02 Jun 2011 14:13:47 GMT
amq.js initHandler() method swallows first message received
-----------------------------------------------------------

                 Key: AMQ-3350
                 URL: https://issues.apache.org/jira/browse/AMQ-3350
             Project: ActiveMQ
          Issue Type: Bug
          Components: JMS client
    Affects Versions: 5.5.0
         Environment: MAC OS X (10.6)
            Reporter: Ken Seiss


The very first message received by a javascript client (when using {{amq.js}}) is swallowed
with no action. This is because the {{sendPoll()}} method calls {{initHandler()}} from the
{{successCallback}} handler when the message arrives and the boolean {{sessionInitialized}}
is false. This sends the code into the {{initHandler()}} method which in the end just calls
{{sendPoll()}} again.  It never bothers calling {{pollHandler()}} to deal with the message
it received.
{code:title=amq.js|borderStyle=solid}

        // *** This method does not process the data passed in. It just calls sendPoll() again!
	var initHandler = function(data) {
		sessionInitialized = true;
		if(sessionInitializedCallback) {
			sessionInitializedCallback();
		}
		sendPoll();
	}

	var sendPoll = function() {
		// Workaround IE6 bug where it caches the response
		// Generate a unique query string with date and random		
		var now = new Date();
		var timeoutArg = sessionInitialized ? timeout : 0.001;
		var data = 'timeout=' + timeoutArg * 1000
				 + '&d=' + now.getTime()
				 + '&r=' + Math.random();

		var successCallback = sessionInitialized ? pollHandler : initHandler;
        
		var options = { method: 'get',
			data: addClientId( data ),
			success: successCallback,
			error: pollErrorHandler};
		adapter.ajax(uri, options);
	};
{code} 


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message