Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Listgrid / Builtin Datasource / Messaging

    Under SmartPower 2.5 I have a page that has a ListGrid on it which is backed by a datasource which is derived from the built-in datasource. So far so good...

    The listgrid is just showing transaction histories from my applicaition. it is not editable in any way.

    My application keeps a limited FIFO of the last N (300?) transactions.

    I want to use the real-time messaging module to be streaming new record additions (and old record removals) from the server to the listgrid.

    I haven't been able to find any documentation or examples for this combination. Is it possible?

    #2
    Of the two samples for Real-Time Messaging in the product, the one for the chart is closely analogous to what you want to do. It maintains an array of data of fixed length, adding new entries received by messaging and trimming old ones.

    Comment


      #3
      I see that the StockChart example has it's own servlet for the DataSource.

      I've been using the simplified form of deriving my DataSources from BasicDataSource (actually from a Generic that I based on BasicDataSource). It requires little to no code for the DataBoundComponents on the client side and very little code on the server side.

      Is there a way to integrate messaging into that scheme or must I implement my own server-side servlet and client-side callbacks?

      Comment


        #4
        No, it does not have it's own servlet for messaging or DataSources. It has a servlet that creates fake updates, just for this sample. You do not need to replicate this.

        Comment


          #5
          I'm sorry, but that's a bit unclear.

          Normally I just tell the DataBoundComponent the name of the DataSource and it initiates the DSRequests (fetch, update, etc) on it's own. The server side BasicDataSource overrides executeFetch() to respond to the requests.

          Can I still use this paradigm? Does a serverside DataSource or BasicDataSource have a way to push data to the client? Or do I need to abandon this model and create explicit servlets for each pushed datastream?

          I'm sorry to be a pest but there isn't much reference material available on this subject.

          Comment


            #6
            We can't tell what's confusing you, try providing much more specifics, for example, how do you get notified that new data is available / new transactions have been added to your FIFO? That's your starting point for generating messages that will be streamed down to the client, but you've not told us anything about this starting point.

            Comment


              #7
              Right now I don't keep a FIFO because the server to client transfer is all driven by client request (pull), not push.

              It is easy enough for me to add a blocking queue or some other structure.

              Since I'm currently 'pull' based I just do the executeFetch() in response to a DSrequest.

              From the StockQuote example it appears that I need to abandon the built-in datasource approach in favor of a servlet which can call the ISCMessageDispatcher.send().

              Comment


                #8
                No, keep your existing DataSource implementation, just stream updates via Messaging, by calling ISCMessageDispatcher.send(), or via using JMS - see the public wiki (wiki.smartclient.com) for a few different setups for JMS (ActiveMQ, JBoss, etc).

                Comment


                  #9
                  Ok, I'll do that, use the Messaging system as the FIFO....
                  Thanks for the help, this is my first experience with the push side of things and it's hard to piece it all together from the sample.

                  Comment


                    #10
                    I haven't found a way to directly connect a ListGrid to an incoming messaging stream.

                    I've seen people's code in the forums and have been able to do the Messaging.subscribe(), but all the examples I've seen then have callbacks which require manual coding of each field to create a Record[].

                    Isn't there a way to pass the incoming messaging data to the databound component and have it use the existing JSO parsing?

                    Comment

                    Working...
                    X