我尝试了Fabric-1.4文档中的commercial-paper Tutorial。一切正常。
现在我想从papercontract.js发出事件,让我们说在“问题”交易中。
在fabric-contract-api中是否有emit事件功能,我可以使用或者必须使用fabric-shim方法来发出事件?
您将使用chaincode stub:https://fabric-shim.github.io/release-1.4/fabric-shim.ChaincodeStub.html#setEvent__anchor中的setEvent方法
用法如下:
// Emit the tradeEvent - passing the whole Commodity Object as the Payload.
ctx.stub.setEvent('tradeEvent', Buffer.from(JSON.stringify(commodity)));
从消费者事件的客户角度来看,目前有一个JIRA正在努力简化事件处理,就像在1.4中简化提交事务一样。 https://jira.hyperledger.org/browse/FABN-1100
事件处理JIRA预计将在Fabric 1.4.1(以及Fabric 2.0)中提供。