Results 1 to 8 of 8
  1. #1

    Multiple smartEndSnapshot calls

    Hi

    we are taking the snapshot data for an item from multiple rest Api calls

    so we are thinking to call endodsnapshot after each api call is made. Is that recommended, will it have any impacts on the ls server.

    Say item1 subscription,
    api -1 success , call end of snapshot
    api-2 success , call end of snapshot
    etc

    our doubt is whether it will impact multiple clients in any manner.

    Iím not understanding the term discarded information, what msged will be discarded??
    After that an unsubscribe call for the Item has returned, further calls of this method for the itemHandler received with the last subscription operation are still allowed and will be just discarded.

    thanks
    rajesh

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

    I can confirm that only the first endOfSnapshot for each Item makes sense for the server.
    All subsequent ones are simply ignored, apart from a possible annoying message in the log.

    Also from a client point of view only the first EOS is significant, all the others are in no way affecting the data flow towards the client.

    About last question, the documentation refer to the case when a Data Adapter still use an itemHandler to push updates after the unsubscribe method was called.
    In that specific case no errors would be generated but simply the updates are ignored.

    Regards,
    Giuseppe

  3. #3
    Thanks Giuseppe for the reply,

    I have another question in command mode subscription mode,

    Consider my data feed is from DB/REST call,
    In subscribe method data retrieval fails for client 1, because of datasource DB/REST API server issue.

    After some time client 2 connects, in this scenario i am noticing that subscribe method is never called untill there are atleast one active subscription for that item.

    Here the scenario is the snapshot data is not sent to server from feed, so the consecutive client connections must some how trigger the subscribe method or data retrieval logic to give the data.


    How to mitigate this call, i tried throwing the
    SubscriptionException,FailureException but i am not seeing any effect. There is no call made to adapter upon second connection.

    Thanks
    Rajesh

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

    The SubscriptionException informs the server that the item is considered failed, and just as in the case of success the subscribe method will no longer be called until at least one active client keeps a subscription for that Item.
    I think that the best practice to cope with such a scenario is that once the Data Adapter determines that the item name is valid, but an external service fails is to return succesfully the subscribe method an start a background task polling the external service at regular intervals.
    If an unbsubscribe will be called before you got a reply from the external service the task will be cancelled.

    Otherwise, if you want to avoid the background task, you should let communicate the Metadata Adapter with the Data Adapter, and replace the subsequent subscribe calls with the notifyNewTable calls.

    Regards,
    Giuseppe

  5. #5
    HI Giuseppe,

    Thanks for the quick reply,

    I am going for the second option - communication between metaData and data adapter.

    Is there a direct way to trigger the subscribe method of data adapter from
    notifyNewTable call, i could see Demos with volatile attributes which trigger the data pull for each item. Apart from that do you have any other recommendation for the communication.

    Thanks
    Rajesh


  6. #6
    Administrator
    Join Date
    Feb 2012
    Location
    Milano
    Posts
    505
    Hi Rajesh,

    Yes you are right, the most convenient solution, especially in case of Java adapters, is that the Metadata holds a reference to the Data Provider instance, and perform direct calls when needed.

    That said, please consider also the possibility that the Metadata call not the subscribe method but a different method in order to distinguish the two cases, the regular subscribe call from the Lightstreamer server, from Metadata incoming calls.

    Regards,
    Giuseppe

  7. #7
    Thanks Giuseppe its acknowledged, I will make sure we have different method calls.

    One question, is it possible to use spring
    Application events for metaData and data adapter communications? Implement ApplicationListener<ApplicationEvent> in our DATA Adapters so we can fire an application event from metaDataAdapter once notifyNewTables is called.

    To put in simple words,
    can we initialize spring context inside adapter life cycle classes ?

    Thanks
    Rajesh

  8. #8
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    958
    Hello Rajesh, We don't have direct experience with this specific integration to share, but in principle we don't pose any restriction on what you can put in the adapters.
    However, the Adapters are loaded in dedicated ClassLoaders and this should be taken into account.
    See the "classloader" elements in adapters.xml.

    To have the Data and Metadata Adapter see each other, it is enough that you stick to the default configuration.
    In this case, a single ClassLoader loads everything in the "lib" subdirectory and is used to load both adapters.
    In this way, also any external library that you put in the common "lib" subdirectory is visible from both adapters.
    The same ClassLoader is also set as the "context ClassLoader" in all invocations to the adapters.
    You should ensure that the library doesn't have additional requirements that are not compatible with this structure.

    It may also be important to consider the order in which the Adapters are loaded and initialized.
    By leveraging the <metadata_adapter_initialised_first> element in adapters.xml you can ensure that the load and initialization of the Metadata Adapter is the first entry point in your code.

 

 

Similar Threads

  1. How to use multiple adapters in one web client
    By sjohn in forum Client APIs
    Replies: 11
    Last Post: January 23rd, 2015, 12:22 PM
  2. recommened usage - multiple item subscription
    By tstojano in forum Client APIs
    Replies: 1
    Last Post: August 13th, 2008, 05:12 PM
  3. Multiple adapters
    By TonyRoberts in forum Adapter APIs
    Replies: 10
    Last Post: September 12th, 2007, 03:46 PM
  4. Multiple connection warning alerts from Firefox
    By Waddy in forum Client APIs
    Replies: 4
    Last Post: May 14th, 2007, 03:38 PM
  5. Accessing multiple adapters
    By Waddy in forum General
    Replies: 2
    Last Post: March 16th, 2007, 07:06 AM

Tags for this Thread

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