Results 1 to 7 of 7
  1. #1

    Advice on Designing Data Adapaters


    I've been reading the documentation and I want to get some advice on how to implement my Data adapters.

    I have 2 sources of data. One will push statistical sampling data and news, while another will be pushing state updates such as stock quotes.

    I plan is to connect to these data source through a socket and whenever I receive data from those sockets I push an update to my clients subscribing to my data adapter.

    Is it best to make one data adapter per data source? Should I make one data adapter for the statistical sampling, while another for state updates and stock quotes?

    For pushing stock quotes, I was planning to have my Items uniquely identified by the stock symbol (ie. MSFT, AAPL) and when my clients subscribe they'll just pass the symbols as the itemName to subscribe to. But I realized my data source will be pumping out data for different stocks and not all messages from my data source needs to be pushed out. Does that mean my data adapter has to keep a listing of all items subscribed and only do an update if the message from the data source is for items subscribed to the data adapater?

  2. #2
    Join Date
    Feb 2012
    Hi Gino,

    The architecture and design of the Adpaters is left completely free so that the developer could choose the philosophy and techniques that will best fit to his situation.
    However, it is generally considered a best practice to separate data semantically different in different Data Adapter. Furthermore, imo, have two different Data Adapters should be easier to implement and more efficient in certain situation.

    I confirm you that you should avoid to push into the Lightsreamer server update for Items not yet, or no longer, subscribed.
    It is true that the server in this eventuality filters itself these updates, but you'll be annoyed with continuous warning messages in the log.
    Is normally adequate keep a map of the subscribed Items updating it regularly in the subscribe and unsubscibe methods of your Data Adapter.

  3. #3
    Hi Giuseppe,

    Thanks again for taking the time to help me out. I will take your advice and implement 2 adapters. It does seem the more organized approach.

    Regarding keeping track of subscribed Items, I was thinking of keeping a map or an array in my node.js adapters to keep track of the Items clients would subscribe to. But I realized if my Items represents stocks in market, I could potentially keep a list of all the stock issues in the market. Is it common practice to keep track if hundreds to thousands of subscribed items on the adapaters and Lightstreamer servers?

    Again thanks for all the help. I appreciate it.

  4. #4
    Senior Member
    Join Date
    Feb 2013
    Hi Gino,

    Keeping track of the subscribed item on the adapter and sending to the Lightstreamer Server just the itemEvents for Items actually subscribed, is a best practice compared to sending all the ItemEvents to the Lightstreamer Server regardless they were subscribed or not and letting the Server deal with them.
    Actually the Lightstreamer SDK for Node Adapters should throw an exception when your adapter tries to send an ItemEvent for an Item not subscribed. Avoid to create unnecessary exceptions is also a good practice, so, yes, I would keep track of the subscribed items, especially if there are thousand of Items and just a small part of them are actually subscribed.
    By the way, do you see these exceptions?

  5. #5
    Hi Marco,

    I just tested it and I do encounter exceptions when sending Items that aren't subscribed.
    Thank you for confirming what the best practice is. Potentially thousands of Items at the same can be subscribed to similar to a stock list for multiple clients.

    For Node.js what would be the best way of keeping track of subscribed items? An array?

    Regards, and thanks all for the input!

  6. #6
    Senior Member
    Join Date
    Feb 2013
    A simple object will do the job

  7. #7
    Thanks Marco!

    Going to try to make a subscription object for my adapter. I appreciate the pointers you are all giving me.



Similar Threads

  1. General data and User specific data
    By mnenchev in forum Adapter SDKs
    Replies: 5
    Last Post: September 1st, 2009, 09:36 AM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
All times are GMT +1. The time now is 11:44 PM.