Hi,
Additional question : What is the javascript class of the message returned
(DOM, XMLHTTPResuest, ....) ?
The existing doc does not help us because in the two example, we saw that we
can use message.getAttribute or message.getChildNodes[0], ... ?
KR,
Charles Moulliard
cmoulliard wrote:
>
> Hi,
>
> I would like to know where the javascript object Message used by
> AJAX/ActiveMq in a HTML page is defined ? I see in the portfolio example
> that we can use the following method "message.getAttribute('stock')" to
> access part of the xml message returned by the queue engine through the
> MessageListenerServlet but I would like to know what are the methods /
> variables available for this message object (which is normally a mirror of
> the jax.jms.Message object) ?
>
> To be more precise, here is a copy/paste of the portfolio.js script of the
> example where message appears at the line _price: function(message)
>
> var priceHandler = {
> _price: function(message) {
> if (message != null) {
> var price = parseFloat(message.getAttribute('bid'))
> var symbol = message.getAttribute('stock')
> var movement = message.getAttribute('movement')
> if (movement == null) {
> movement = 'up'
> }
>
> var row = document.getElementById(symbol)
> if (row) {
> // perform portfolio calculations
> var value = asFloat(find(row, 'amount')) * price
> var pl = value - asFloat(find(row, 'cost'))
>
> // now lets update the HTML DOM
> find(row, 'price').innerHTML = fixedDigits(price, 2)
> find(row, 'value').innerHTML = fixedDigits(value, 2)
> find(row, 'pl').innerHTML = fixedDigits(pl, 2)
> find(row, 'price').className = movement
> find(row, 'pl').className = pl >= 0 ? 'up' : 'down'
> }
> }
> }
> };
>
> function portfolioPoll(first)
> {
> if (first)
> {
> amq.addListener('stocks','topic://STOCKS.*',priceHandler._price);
> }
> }
>
> amq.addPollHandler(portfolioPoll);
>
> Remark : addtiaional question
> - Who will cal the function portfolioPoll(first) function ?
> - How is the parameter first which is a boolean setted ?
>
> KR,
>
> Charles Moulliard
>
-----
Enterprise Architect
Xpectis
12, route d'Esch
L-1470 Luxembourg
Phone +352 25 10 70 470
Mobile +352 621 45 36 22
e-mail : [EMAIL PROTECTED]
web site : www.xpectis.com www.xpectis.com
My Blog : http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/
--
View this message in context:
http://www.nabble.com/Where-the-Message-object-%28javascript%29-of-amq.js-is-defined---tp20090852p20106488.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.