Return-Path: X-Original-To: apmail-activemq-dev-archive@www.apache.org Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EA9FA100DB for ; Sat, 2 Nov 2013 22:03:18 +0000 (UTC) Received: (qmail 82543 invoked by uid 500); 2 Nov 2013 22:03:18 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 82487 invoked by uid 500); 2 Nov 2013 22:03:18 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 82363 invoked by uid 99); 2 Nov 2013 22:03:18 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 Nov 2013 22:03:18 +0000 Date: Sat, 2 Nov 2013 22:03:18 +0000 (UTC) From: "Claus Ibsen (JIRA)" To: dev@activemq.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (AMQ-3350) amq.js initHandler() method swallows first message received MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/AMQ-3350?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Claus Ibsen updated AMQ-3350: ----------------------------- Priority: Trivial (was: Major) > 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 > 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)