Results 1 to 4 of 4
  1. #1

    onItemUpdate() receives null value of item under DISTINCT mode

    When a client subscribed to ITEM.fieldA in DISTINCT mode, and the DataAdapter makes an update of ITEM.fieldB without fieldA. The client received a null value event. Is it normal? How can it be avoid?

    Below is the server side code for testing purpose:


    Below is the client side code for testing purpose:


    Output from console:
    fieldA: null
    fieldA: valueA
    Last edited by Manta LI; July 1st, 2016 at 06:58 AM.

  2. #2
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    505
    Hi Manta LI,

    I confirm that the observed behavior is something expected.
    Indeed, one of the main differences between the DISTINCT mode and MERGE mode is just that DISTINCT not allow conflation. Ie. the feed does not produce data that replaces the previous one, but each event is distinct from the previous one.
    Therefore, if for an update the value of a field is not specified:
    - in MERGE mode the previous value is assumed;
    - in DISTINCT mode null value is assumed.

    You might consider switching to a MERGE mode subscription but with a buffer greater than 1. Please refer to section "3.3.7 ItemEventBuffer in MERGE Mode" of "General Concepts" documentation.
    But please you should evaluate that if you switch to MERGE you give up the snapshot with size greater than 1.

    Regards,
    Giuseppe

  3. #3
    Thanks for your answer.

    If there is an item which some fields that need to be DISTINCT and some to be MERGE, how to manage?

    Example:
    [SYNTAX=JAVA]public class StockMarketData()
    {
    public String open;
    public String high;
    public String low;
    public String close;
    public String nominalPrice;
    public String[] intradayTradeTickers;
    }[SYNTAX]

    Is it possible to make 2 subscriptions on the same item, 1 for MERGE fields and 1 for DISTINCT?

    Quote Originally Posted by giuseppe.corti View Post
    Hi Manta LI,

    I confirm that the observed behavior is something expected.
    Indeed, one of the main differences between the DISTINCT mode and MERGE mode is just that DISTINCT not allow conflation. Ie. the feed does not produce data that replaces the previous one, but each event is distinct from the previous one.
    Therefore, if for an update the value of a field is not specified:
    - in MERGE mode the previous value is assumed;
    - in DISTINCT mode null value is assumed.

    You might consider switching to a MERGE mode subscription but with a buffer greater than 1. Please refer to section "3.3.7 ItemEventBuffer in MERGE Mode" of "General Concepts" documentation.
    But please you should evaluate that if you switch to MERGE you give up the snapshot with size greater than 1.

    Regards,
    Giuseppe

  4. #4
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    505
    Hi Manta LI,

    No, MERGE and DISTINCT are two conflicting mode. So the same Item could not be subcribed by two subscriptions the first in MERGE mode and the second in DISTINCT mode. The latter subscription fails and does not return any data.
    Indeed you should implement the modeMayBeAllowed method in your adapter to ensure that each Item only accept the planned mode.

    As for your example I think you have to separate the fields in two separate Items:
    - open, high, low, close, nominalPrice in a MERGE allowed Item;
    - intradayTradeTickers in a DISTINCT allowed Item.

    Regards,
    Giuseppe

 

 

Similar Threads

  1. Basic Stock Demo in DISTINCT mode
    By Virendra in forum Adapter APIs
    Replies: 1
    Last Post: May 20th, 2016, 10:38 AM
  2. Null values on Item update
    By Ranag in forum Adapter APIs
    Replies: 1
    Last Post: December 12th, 2014, 10:03 AM
  3. Replies: 4
    Last Post: September 24th, 2013, 10:28 AM
  4. Difference between DISTINCT and MERGE mode?
    By hungtt in forum General
    Replies: 1
    Last Post: January 4th, 2011, 01:07 PM
  5. DISTINCT updates are NULL with recent LS server
    By rsouissi in forum Client APIs
    Replies: 4
    Last Post: March 6th, 2008, 02:59 PM

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 10:57 AM.