activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (AMQ-3350) amq.js initHandler() method swallows first message received
Date Sun, 03 Nov 2013 07:56:17 GMT

     [ https://issues.apache.org/jira/browse/AMQ-3350?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Claus Ibsen resolved AMQ-3350.
------------------------------

    Resolution: Fixed

Thanks for the patch.

> 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
>    Affects Versions: 5.5.0
>         Environment: MAC OS X (10.6)
>            Reporter: Ken Seiss
>            Assignee: Claus Ibsen
>            Priority: Trivial
>             Fix For: 5.10.0
>
>
> 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 was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message