Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Nov 2007
    Location
    VN
    Posts
    12

    Angry how to make 2 schemas


    Schema1[Score]
    Item Code Ref Ce Fl
    Item1 ABC 10 12 8
    Item2 XYZ 20 24 16


    Schema2[Index]
    Item Session Index IndexChange
    Item1 1 1006 6
    Item2 2 1007 7


    I done good with 1 schema but....
    If I have 2 schemas, so what I need to do ? I must be make 2 data_adapter on server?
    and client code have a change too ?
    thanks a lot

    (I code LS by C#.net 2005)

  2. #2
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,089
    The condition for requesting two different schemas for the same items is to perform two distinct subscriptions from the client. On the Server side, you still need a single Data Adapter, which only receives one subscription request with no field informations; hence, it should always provide values for all the possible fields upon each update.
    Please, expand the question if I didn't understand it correctly.

  3. #3
    Member
    Join Date
    Nov 2007
    Location
    VN
    Posts
    12

    Angry

    Quote Originally Posted by DarioCrivelli
    The condition for requesting two different schemas for the same items is to perform two distinct subscriptions from the client. On the Server side, you still need a single Data Adapter, which only receives one subscription request with no field informations; hence, it should always provide values for all the possible fields upon each update.
    Please, expand the question if I didn't understand it correctly.

    Schema1[Score]
    Item Code Ref Ce Fl
    CodeItem1 ABC 10 12 8
    CodeItem2 XYZ 20 24 16


    Schema2[Index]
    Item Session Index IndexChange
    IndexItem1 1 1006 6
    IndexItem2 2 1007 7


    I think have a misunderstood here. No same items. Item names of schema1 will be complete different with item names of schema2
    In the case have only 1 schema: I have 1 launcher to create instant of Schema1 [Code]
    So if I have 2 schemas: I need more 1 launcher to create instant of Schema2 [Index]
    Maybe I think it better?
    thanks

  4. #4
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,089
    We still have problems in understanding the question.
    A "schema" is a list of fields to be subscribed to by the client, hence it's not clear what you mean by "create instant of Schema1".
    By each "launcher" are you referring to a distinct Remote Server instance?
    Then no, a single Data Adapter (hence, a single Remote Server) must be used to supply all the items that a single client requires. A single Data Adapter can handle subscriptions for multiple items and feed each item with the proper fields.
    Your Data Adapter should be able to distinguish different kinds of items based on their name and supply field values accordingly. Upon subscribe("CodeItem1") it should supply Code=ABD Ref=10 Ce=12 Fl=8 and upon subscribe("ItemIndex1") it should supply Session=1 Index=1006 IndexChange=6

  5. #5
    Senior Member
    Join Date
    Oct 2007
    Location
    HoChiMinh
    Posts
    69
    Hi Skidrow406,
    I'm not sure understand your question, but in my opion, u mean (see picture below) :
    You have 2 schema (something like that) :
    ----
    var schema = ["last_price", "time", "_change", "bid1vol", "bid1", "ask1", "ask1vol", "min", "max", "ref_price", "open_price", "stock_symbol", "ceiling" , "floor", "bid2vol", ...,"item_status"];

    var schema2 = ["vnindex", "idxVol", "idxVal","idxchange", "item_status"];

    -----

    ---
    I think u need created 2 class :
    ---
    public class IndexProducer
    {


    private IExternalFeedListener _listener;

    public IndexProducer(Int32 vnIndex, Int64 TotalShare, Int64 TotalValue, Int32 idxTime)
    {
    ...
    }

    public void SetFeedListener(IExternalFeedListener listener)
    {
    lock (this)
    {
    _listener = listener;
    }
    }

    public IDictionary GetCurrentValues(bool fullData)
    {
    lock (this)
    {
    IDictionary eventData = new Hashtable();

    if (fullData)
    {
    ...
    }
    return eventData;
    }
    }

    }

    ----

    public class ExternalFeedProducer
    {
    ...

    private IExternalFeedListener _listener;


    public ExternalFeedProducer(string name, Int32 openPrice, ... string status)
    {

    ...

    }

    public string GetItemName() {
    return _itemName;
    }

    public void SetFeedListener(IExternalFeedListener listener) {
    lock (this) {
    _listener = listener;
    }
    }



    public IDictionary GetCurrentValues(bool fullData)
    {
    ReadINIFile settings;
    lock (this)
    {
    IDictionary eventData = new Hashtable();

    ...

    if (fullData)
    {

    ...


    }
    return eventData;
    }
    }
    }

    And then
    -------
    public void Run()
    {

    ...

    //for each stock
    for (int i=0; i < nStock; i++)
    {
    //create an IDictionary to store all field name/value pairs associate the IDictionary to the stock name in _snaps
    string itemName= "item" + (i + 1);

    ExternalFeedProducer myProducer = new ExternalFeedProducer(itemName, _openprices[i], .., _status[i]);

    _stockGenerators[itemName]= myProducer;

    //call onEvent on the listener and send the IDictionary
    _listener.OnEvent(myProducer.GetItemName(), myProducer.GetCurrentValues(true), true);

    }
    //for each Index
    for (int i=0; i < nStock; i++)
    {
    //create an IDictionary to store all field name/value pairs associate the IDictionary to the stock name in _snaps
    string itemName= "indexItem" + (i + 1);

    IndexProducer myProducer = new IndexProducer (itemName,...);

    _stockGenerators[itemName]= myProducer;

    //call onEvent on the listener and send the IDictionary
    _listener.OnEvent(myProducer.GetItemName(), myProducer.GetCurrentValues(true), true);

    }
    ...
    }

    That's right?

  6. #6
    Member
    Join Date
    Nov 2007
    Location
    VN
    Posts
    12
    thanks DarioCrivelli & tuongkha
    I understood your ideal, DarioCrivelli
    so that I have only 1 schema and I feed data upon the itemname from client
    Code:
    Item        Code  Ref Ce Fl Session Index IndexChange
    -----------------------------------------------------
    CodeItem1   ABC   10  12 8  0       0     0
    CodeItem2   XYZ   20  24 16 0       0     0
    IndexItem1  0     0   0  0  1       1006  6
    IndexItem2  0     0   0  0  2       1007  7
    I will try this solution!
    Thanks again!

 

 

Similar Threads

  1. Replies: 5
    Last Post: April 30th, 2010, 11:03 AM

Bookmarks

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:59 AM.