DejanMilosevic
Hi,
We've implemented ARI protocol in Java quite successfully so far, but now I think we're missing something.
How will remote Data Adapter know if client requested a snapshot if there's no isSnapshotAvailable() method call from LS kernel? Should I just send a snapshot on first subscribe() call, no matter if client requested it or not? Also, should I just start sending isSnapshot = false updates if my Data Adapter actually doesn't support snapshots for the specified item? If so, what is the purpose of isSnapshotAvailable() method on DataProvider interface anyway (non ARI implementation)?
Tnx,
Dejan
marco.testa
Hi Dejan,
The snapshot to be sent to the client is actually managed by the Lightstreamer Server. It is the responsibility of the Server to maintain the snapshot for a given Item and to send it to the client when a client subscribes to an Item, requiring the snapshot.
The server in turn expects to receive the snapshot from the Data Adapter only the first time it subscribes to a given item on the Data Adapter, and this happens the first time a Client subscribes to the Item.
For all the following clients subscribing to the same Item, the server sends directly the snapshot, which already retains, to the client, without expecting anything from the Adapter.
The server keeps the snapshot while at least one client is subscribed to the item. When also the last client unsubscribes the Item, the Server in turns unsubscribes the Item from the Data Adapter and discards the snapshot. The next client subscribing to the same item will cause again the Server to subscribe to the Data Adapter and to expect the snapshot.
When the Server subscribes an Item to the Data Adapter, the Data Adapter may send ItemUpdates with the flag 'is snapshot', followed by the 'endOfSnapshot', or may send directly the 'endOfSnapshot' if no snapshot is available.
After having received the 'endOfSnapshot', the Server expects every following itemUpdate for the same Item not to be flagged as 'isSnapshot'.
If the Data Adapter is not able to send the snapshot for any Item, after any subscription it should send immediately the 'endOfSnashot', otherwise, in case of a not-remote Data Adapter it may return 'false' from the 'isSnapshotAvailabe' method. In the later case the Server doesn't even expect to receive the 'endOfSnapshot'.
Due to the round trip, for the server there is actually no advantage to ask 'isSnapshotAvailable' to a Remote Data Adapter, and the Server always expects to receive a 'endOfSnapshot' from a Remote Data Adapter. So, a Remote Data Adapter must always send an End Of Snapshot to the Proxy Adapter during the subscription of the item, even if the snapshot for an item is not available.
hth,
Marco
DejanMilosevic
Tnx Marco, this clears up everything.
Docs should definitely be updated.
BR,
Dejan
Alessandro Alinone
Hi Dejan,
Would you be so kind to suggest us where you would like to see more details in the documentation of the ARI protocol? Your feedback is precious.
Thanks,
Alessandro
DejanMilosevic
Hi Alessandro,
I'm using a pdf doc "Adapter Remoting Infrastructure - Network Protocol Specification", Last updated: 3/12/2012 as a reference.
I'd add details about each method in chapters 2.4 and 2.5; especially important are the ones that differ from non ARI protocol (so their doc can't be found in Java API doc for DataProvider / MetadataProvider). Then, some kind of flow diagram for ARI should be shown, with explanation of the steps (e.g. something like in chapter 4.2 of the doc "General Concepts"), as it is not the same in ARI / non ARI implementations.
BR,
Dejan
Alessandro Alinone
Thanks Dejan!