Transaction event is not emitted after successful invoke #fabric-sdk-node


Kumari Shweta
 

Hi Team,
I am using fabric node sdk api for events.
Transaction (commitEvent) is not working.New block is generated successfully but transaction event is not emitted.

Passing eventhandler option in gatewayoption in following way.

 

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    await gateway.connect(ccp, {

        wallet,

        identity: appUser,

        discovery: {

            enabled: true,

            asLocalhost: true

          },

                eventHandlerOptions: {

                commitTimeout: 300,

                strategy: DefaultEventHandlerStrategies.MSPID_SCOPE_ANYFORTX

            }

       // }

    });

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 

const listener = (error, event) => {

           console.log("event is called................");

    if (error) { 

        console.log("error========================",error);

    } else {

// Handle transaction commit event

    }

}

 

const peers = network.getChannel().getEndorsers("Org1MSP");

const transaction =  contract.createTransaction("createCar");

 

await network.addCommitListener(listener, peers, transaction.getTransactionId());

const result =  await transaction.submit('createCar' ,'CAR1112', 'Honda', 'Accord', 'Black', 'Tom' );

console.log('Transaction has been submitted');


let me correct if anything wrong.

Thanks 

 

Join fabric@lists.hyperledger.org to automatically receive all group messages.