0

Currently ,in fabric gateway API when we submit the transaction using APIs provided by TransactionImpl ,inside commitTransaction method of TranscatioImpl it creates commitHandler on network and transaction Id and after sending the transaction to channel,it waits for the response to come back by calling commitHandler.waitForevents .Is there any way I can do this in asynchronous way ,i.e. after submitting the transaction to orderer, I want to proceed submitting next transaction and write a separate event listener which would listen on the events coming back from fabric and take some action on them as and when they recieve.

Mani
  • 283
  • 3
  • 21

1 Answers1

1

You don't have to wait on submitTransaction if you don't want to, for example suppose you want to submit a number of transactions and wait for them all to commit then you can just collect the promises from submitTransaction and wait on them at a later point in time. If you don't care when your transaction is committed then you can specify the gateway commit strategy as null which means it won't even bother to listen for transaction committed events. see https://hyperledger.github.io/fabric-sdk-node/release-1.4/tutorial-transaction-commit-events.html for more info

If you want to do your own event handling you can add contract/block/transaction event listeners yourself

see https://hyperledger.github.io/fabric-sdk-node/release-1.4/tutorial-listening-to-events.html

for more details

david_k
  • 5,843
  • 2
  • 9
  • 16
  • Thanks for reply..i will try this by writing a sample code and revert as soon as it works – Mani Feb 08 '20 at 10:29