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

Jim Cook updated AMQ-1377:
--------------------------

    Attachment: amq_js.zip

I have included an attachment containing the changes this issue describes. 

The refactor is entirely client-side and the AjaxServlet and MessageListener 
Servlet have not been modified. The refactor breaks out prototype's AJAX 
handling from the core _amq.js file and replaces it with an adapter class. Also 
included is an adapter for jQuery. Here is a description of changes in each 
major file.
---
h4. chat.html
- No longer uses amq.js that loads _amq.js, prototype.js and behavior.js. 
SImple add amq.js which now contains the full client-side jms implementation 
that communicates with the AjaxServlet on the server.
- Initialization code slightly different now. The chat event handlers and 
general initialization is now purposeful instead of triggered by a quirky poll 
handler.

h4. amq.js
- This file is not quite different. It has been reorganized to support a 
namespace and private/pubic properties and methods.
- The batch process has been refactored from its reference counter 
implementation to a simple queue. I was experiencing bugs using the prior 
approach and this simpler approach seems to offer the same capabilities, 
especially since only one AJAX POST can be made to the server at a time. Please 
correct me if I am wrong or overlooked something.
- The AJAX and logging functionality has been externalized to an adapter class.
- Added some basic error recovery (reconnect), however this is an area where 
more improvement is needed.
- Removed the pollHandler functionality although it is trivial to add back. It 
was being misused (along with a 'first' boolean value and a jiggered timeout 
value) to initialize the chat.html page.

h4. amq_xxx_adapter.js
- These are the adapter files that externalize the AJAX call on behalf of the 
amq.js file.
- They also can externalize logging, however they just log to Firebug right now.

> amq.js should not have a dependency on prototype.js
> ---------------------------------------------------
>
>                 Key: AMQ-1377
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1377
>             Project: ActiveMQ
>          Issue Type: Improvement
>          Components: Broker
>    Affects Versions: 5.0.0
>            Reporter: Jim Cook
>         Attachments: amq_js.zip
>
>
> amq.js uses a script loading technique to include behavior.js, prototype.js 
> and _amq.js. The Behavior library is included only for the purposes of the 
> chat client and is only GUI in nature, so that should go. Also, Prototype is 
> included for its AJAX functionality, however everyone has their favorite 
> javascript library and although I cut my teeth on prototype, I use jQuery 
> now. I certainly don't want amq.js to include prototype when I have a 
> perfectly good AJAX library already included in jQuery.
> IMHO, amq.js should include only the functionality of client-side 
> javascript-enabled JMS. The page author should include her AJAX library of 
> choice (prototype, dojo, jquery, mootools, etc.) and an adapter class that 
> allows amq.js to use the particular ajax library.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to