Date
1 - 3 of 3
event listener options in fabric go sdk
Mark Lewis
If you are using (or can use) Fabric v2.4, the Fabric Gateway client API provides this capability consistently for Go, Node and Java clients:
- Go: https://pkg.go.dev/github.com/hyperledger/fabric-gateway/pkg/client#example-Network.BlockEvents
- Node: https://hyperledger.github.io/fabric-gateway/main/api/node/interfaces/Network.html#getBlockEvents
- Java: https://hyperledger.github.io/fabric-gateway/main/api/java/org/hyperledger/fabric/client/Network.html
Mark Lewis
Re-reading your mail, I realise that you might be retrieving chaincode events rather than block events. The story here is similar to block events, and the Fabric Gateway client API allows you to specify either a specific start block or, using a checkpointer, a specific transaction ID. If specifying a transaction ID, events are received from the transaction immediately following that transaction ID. The idea here is that are checkpointing successfully processed events and can resume listening without missing or duplicating events.
Unlike the legacy SDKs, which receive full blocks from the peer and extract the chaincode events, the Fabric Gateway client API receives only the chaincode events directly from the Gateway peer, so there can be significantly lower network overhead.
- Go: https://pkg.go.dev/github.com/hyperledger/fabric-gateway/pkg/client#example-Network.ChaincodeEvents-Checkpoint
- Node: https://hyperledger.github.io/fabric-gateway/main/api/node/interfaces/Network.html
- Java: https://hyperledger.github.io/fabric-gateway/main/api/java/org/hyperledger/fabric/client/Network.html
Unlike the legacy SDKs, which receive full blocks from the peer and extract the chaincode events, the Fabric Gateway client API receives only the chaincode events directly from the Gateway peer, so there can be significantly lower network overhead.