Hyperledger Fabric events delivery guarantee

Viewed 137

We are building a project in which we are planning to use events to trigger various different tasks. My doubt is that due to some circumstances if the client goes down and when we bring back the client will the client can retrieve the missed chaincode events ?

1 Answers

Yes, you can replay the missed events emitted by peers using Event checkpointing. Events are emitted by peers when blocks are committed. Two types of events support checkpointing:

  1. Contract events (also known as chaincode events) - Defined in transactions to be emitted. E.g. an event emitted when a commercial paper is sold

  2. Block Events - Emitted when a block is committed.

Checkpointers:

The BaseCheckpoint class is an interface that is to be used by all Checkpoint classes. fabric-network has one default class, module:fabric-network~FileSystemCheckpointer that is exported as a factory in the module:fabric-network~CheckpointFactories. The FILE_SYSTEM_CHECKPOINTER is the default checkpointer.

A checkpoint factory is a function that returns an instance with BaseCheckpointer as a parent class. These classes implement the async save(channelName, listenerName) and async load() functions.

BaseCheckpointer.save() is called after the async callback function given to the event listener has finished processing.

You can configure custom Checkpointers.

Refer to this to see the tutorial.

Related