I’m hoping to connect an external system to listen in on contracts being created/updated through dazl and the ledger API so that I can, for example, send a notification/email when something occurs.
Looking at the docs here dazl.ledger and the examples of opening up a stream
# asynchronous connections
async with conn.stream() as stream:
async for event in stream.creates():
# print every contract create...forever
print(event.contract_id, event.payload)
I have a few questions:
- All the streams seem to open up from the beginning, is there a way to skip to a certain point? Once we have years of data, there needs to be a way to skip to today, the latest or only new ones from here on out
- Is registering callbacks still a good pattern to use?
# registering a callback using a decorator
@stream.on_create("My:Tmpl")
def handle(event):
conn.exercise(event.cid, "Accept")
- If dazl doesn’t have this functionality, is using the Ledger API directly an option? Does the grpc API have a way to handle question 1