Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

HyperLeger Fabric SDK Development (5)-- event

Shulou Source: shulou.com Published: 2022-06-03 06:50:52 11月23日 Update

HyperLeger Fabric SDK development (5)-- event 1, introduction to event 1, introduction to event

The event package supports access to channel events on the Fabric network. The event client can receive block events, filter block events, chain code events and transaction status events.

Official documents:

Https://godoc.org/github.com/hyperledger/fabric-sdk-go/pkg/client/event

2. The basic process of using event

The basic process for using event is as follows:

A. prepare the channel client context

B. Create an event client

C, registration event

D, handling events (or timeouts)

E, logout event

Examples of use:

Ec, err: = New (mockChannelProvider ("mychannel") if err! = nil {fmt.Println ("failed to create client")} registration, notifier, err: = ec.RegisterChaincodeEvent ("examplecc", "event123") if err! = nil {fmt.Println ("failed to register chaincode event")} defer ec.Unregister (registration) select {case ccEvent: =

Tags: Events blocks channels examples customers clients objects transactions parameters status filters support only permissions processes users profiles development up and down context Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS NVidia Shulou Information Xiaomi Redmi