Stock Quotes

The example for the Getting Started guide. It shows:

  1. How to handle a custom event in the Event Map
  2. How to use the view Injectors to get the data from the Model Manag

 

ColdFusion version

View Source

Download Source

 

WebService version

We have also created a version of this example that does not require ColdFusion. It calls the Stock Quotes web service directly. Because of that, it also has an additional class that parses the data before passing it to the QuoteManager class that stores it. In order to that, we added a MethodInvoker tag between the <resultHandlers> tag and the MethodInvoker tag that called the QuoteManager.

View Source

Download Source


5 responses so far

  1. This example needs libs/Mate_06_2.swc not the Mate_06_1.swc bundled here.
  2. Hi Matt,
    Sorry about that. I've updated the zip, I hope it works now.
    By the way, were you the person that came to me before the session?
  3. No problem at all. Yes I was one of the guys that brought this up before the presentation. You were right that this was the problem for getting it to compile. This is a nice, clean example. Thanks!
  4. Hi,

    This is very interesting stuff, much easier to follow than cairngorm so far... But I do have one simple question?

    I'm unsure of how the program flow works withinthe result handlers.

    Does each MethodInvoker get called in sequence? And how the result of QuoteSericeParser is passed along to QuoteManager. I can see hints in the code such as lastReturn.lastPrice, but I'd just like a bit of clarification on this point if possible?

    Many thanks,

    Matt Law

             <resultHandlers>
                <!-- parse the results -->
                <MethodInvoker generator="{QuoteServiceParser}" method="parseQuoteResults"
                   arguments="{resultObject}" cache="false" />
                   
                <!-- store the last price from the parsed results -->
                <MethodInvoker generator="{QuoteManager}"
                   method="storeQuote" arguments="{lastReturn.lastPrice}"/>
             </resultHandlers>
  5. Hi Matt,
    That's right, all tags inside the handlers are executed in order unless they are nested inside the result of an asynchronous call (resultHandlers or faultHandlers for example). And yes, the result is sent to the storeQuote function by using lastReturn.

    See Using lastReturn for more information. Also see EventHandlers, the last section called "Order of the inner tags is important".

Leave a Reply