hashgraph / did-sdk-java

Support for the Hedera Hashgraph DID Method and Verifiable Credentials on the Hedera Java SDK
Apache License 2.0
29 stars 17 forks source link

Mirror listener subscribes from "now" #4

Open gregscullard opened 4 years ago

gregscullard commented 4 years ago

Problem The mirror listener subscribes from the current date/time, this could result in any messages sent while the listener was down to be missed. This is ok for demonstration purposes, but not sufficient for production use.

Solution Subscription should start from the consensus timestamp (+1 nano) of the last notification.

Alternatives There are no alternatives that would ensure no loss of notifications.

pjn82 commented 4 years ago

That is true for the example appnet implementation and is described in the AppnetServer:

Example appnet server that exposes DID and VC REST APIs. This application uses only in-memory storage for demonstration purposes. Upon server shutdown all data is lost. The listener starts listening from now on (minus buffer time of a few seconds). As it is a demonstration application, it only operates on data received at runtime. All messages submitted to the same topic in the past are ignored.

From demonstration perspective it makes sense, as we always have a 'clean' demo state - especially that it runs in memory only.

Obviously production grade applications will need to implement persistent storage and configure their listeners accordingly. The SDK exposes startTime method for topic listeners, so it can be set up.

vijayshiyani commented 2 years ago

This ticket should be closed as the proposed solution was already implemented earlier. for more info visit 112270a