Results 1 to 9 of 9

Thread: RoundTrip Demo

  1. #1

    RoundTrip Demo

    Hello,

    When I last contacted you I had problems increasing the subscriptions in the grid from 5 to 100 in the RoundTrip Demo.
    That was solved after your instruction to uncheck the limit by replacing the regex at L115 of the RoundTrip Adaptor java file with:

    - if (!item.matches("^roundtrip[0-9][0-9]?$|^100$")).

    I now wish to increase the subscriptions to 1000 but the regex argument in L115:

    if (!item.matches("^roundtrip[0-9]{1,3}$"))-

    rejects any subscriptions exceeding 100.

    I have decompiled the newly recompiled LS_roundtrip_data_adapter.jar and verified that the new regex parameters have been updated to [0-9]{1,3} in both the internally archived java and class files.

    It appears that the earlier 100-subscriber version of the adaptor is being referenced because recompiling it back to the original 5-subscriber limit seems to have no impact, it still registers 100 subscriptions.

    Your assistance would be much appreciated, thank you.

    best regards,

    longtrain0

  2. #2
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    543
    Hi longtrain0,

    Please note that the regex check was intrduced in our code just as a quick way to discriminate the provided Items (only 5) for the demo.
    In your implementation, if this requirement is changed, you can change substantially the check, for example by leaving only a check for a prefix in the Item names.

    However, that said, I think that your issue is that, for some reason, the Lightstreamer server loads your Adapter with binary code different from the expected one.
    Please could you check if the folder where you deploy the jar is the one actually read by Lightstreamer server.
    Could you add an identification log at the beginning of the Init method?

    Thank you,
    Giuseppe

  3. #3

    Rountrip demo

    Hello Guiseppe,

    Thank you kindly for responding to my query.

    Since my previous post I have discovered that I was not copying newly compiled LS_roundtrip_data_adapter.jar files to the required adapters/lib folder. However, I still have an issue configuring the file to add more than 99 items.

    Numerous attempts to implement your suggestions have failed because my Java experience is shamefully inadequate.

    Could you please provide some sample code to illustrate how to leave only a prefix in the Item names check and how to add an identification tag to the init method at line 85.

    Your assistance is much appreciated.

    regards,
    longtrain0

  4. #4
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    543
    Hi longtrain0,

    Once defined at the beginning of RoundTripDataAdapter class



    you should replace



    with something like this



    About the identification in the init method, I meant to add a specific identifier to the "ready" log in order to detect which version is running. Ie.



    Regards,
    Giuseppe

  5. #5
    Hello Guiseppe,

    Thank you once again for your time and assistance.

    I have modified my code to include your sample code as follows:

    ... public class RoundTripDataAdapter implements SmartDataProvider {

    private static final String ROUNDTRIP_PREFIX = "roundtrip"; ...

    and further down:

    ... // Adapter ready
    logger.info("RounTripDataAdapter V28 ready");

    }

    public void subscribe(String item, Object handle, boolean arg2)
    throws SubscriptionException, FailureException {


    assert(! subscriptions.containsKey(item));


    if (!item.startsWith(ROUNDTRIP_PREFIX) ) {
    //valid items are in the range rountrip0 - roundtrip999
    throw new SubscriptionException("No such item");
    } ...

    Unfortunately, the result is the same as before.
    Any item numbered higher than 'roundtrip99', e.g. 'roundtrip100', stillreturns the following error:

    ... 19.Apr.16 14:17:55,098 < INFO> roundtrip1 subscribed
    19.Apr.16 14:17:55,098 < INFO> roundtrip99 subscribed
    19.Apr.16 14:21:23,811 < WARN> Received message for wrong or not-subscribed channel
    19.Apr.16 14:21:23,811 < WARN> Wrong message received: RT|100| 100 ...

    The log also indicates that the Server is referencing the correct adaptor file by returning the following:
    ... 19.Apr.16 14:17:54,552 < INFO> RounTripDataAdapter V28 ready ...

    The following is an extract from the decompiled jar, indicating that the prefix string is passing to the argument:

    ... this.logger.info((Object)"RounTripDataAdapter V28 ready");

    }

    public void subscribe(String item, Object handle, boolean arg2) throws SubscriptionException, FailureException {
    assert (!this.subscriptions.containsKey(item));
    if (!item.startsWith("roundtrip")) {
    throw new SubscriptionException("No such item");
    }
    this.subscriptions.put(item, handle);
    this.sendSnapshot(item);
    this.logger.info((Object)(item + " subscribed"));
    }

    I hope sufficient information has been provided to further investigate this problem.

    Many thanks and best regards,

    longtrain0


    Quote Originally Posted by giuseppe.corti View Post
    Hi longtrain0,

    Once defined at the beginning of RoundTripDataAdapter class



    you should replace



    with something like this



    About the identification in the init method, I meant to add a specific identifier to the "ready" log in order to detect which version is running. Ie.



    Regards,
    Giuseppe

  6. #6
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    543
    Hi longtrain0,

    I think I have figured out what is the problem.

    Whit the Item 'roundtrip100', it is not the subscribe method that fails, but rather the sendMessage method of the RoundTripDataAdapter class.
    And this probably happens because the Items above 99 are actually never subscribed.

    In the demo client all the Items were subscribed in advance since they are listed in a StaticGrid. Your code continues to follow this pattern?

    Regards,
    Giuseppe

  7. #7
    Good Morning Giuseppe,

    Thank you for responding so swiftly.

    I have a simple "send" page with the following code:

    <input type="text" onclick="ssubmit(1, ' 1')" value= " 1 " >
    <input type="text" onclick="ssubmit(99, ' 99')" value= " 99 " >
    <input type="text" onclick="ssubmit(100, ' 100')" value= " 100 " >

    and an "update" page with the following code:
    <div data-source="lightstreamer" data-grid="roundtrip" data-item="roundtrip1" data-field="message" >
    <div data-source="lightstreamer" data-grid="roundtrip" data-item="roundtrip99" data-field="message" >
    <div data-source="lightstreamer" data-grid="roundtrip" data-item="roundtrip100" data-field="message" >
    If I delete the third line in the "update" page, no error messages appear and the first two values are displayed i.e. " 1 " and " 99 " .

    However, with the third line ("roundtrip100") included, an error is thrown and the page goes completely blank and displays neither of the previous values.

    Many thanks and best regards.

    Longtrain0

  8. #8
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    543
    Hi longtrain0,

    Ok, the third line in the "update" page is really necessary.
    At this point, the problem may be in adapters.xml, maybe you have something like this?



    Please change it in order to accept also roundtrip100 and similar:



    Regards,
    Giuseppe

  9. #9
    Giuseppe, tu sei il re del mondo!

    Thank you so much, my problem is now solved.

    Have a great day my friend.

    best regards,

    longtrain0

 

 

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 08:31 AM.