App Listeners

App Listeners allows you to get notified when certain events happen in an App. The current list of supported events are:

List of App Listener events

Asset

  • Asset Type Created - When an Asset type is created

  • Asset Type Updated- When an Asset type is updated

  • Asset Type Deleted- When an Asset type is deleted

  • Asset Created- When an Asset is created

  • Asset Updated- When an Asset is updated

  • Asset Owners Updated- When Asset owners are updated

  • Asset Deleted- When Asset is deleted

  • Approval Request Created- When an ownership approval request is created

  • Approval Request Updated- When an ownership approval request is updated

  • Request Approved- When a request is approved

  • Request Rejected- When a request is rejected

  • Request Cancelled- When a request is cancelled

Workflow

This event should be enabled if the 'Raise Event' action is set up in a workflow. Once enabled, you will be notified every time the workflow goes through a raise event block.

Refer workflow action -Raise Event


The event data is a JSON structure containing the following fields:

  • channelName: Name of the channel that generated the event

  • chaincodeName: Name of the chaincode that generated the event

  • eventType: The event type above that identifies the specific event

  • eventData: The actual event data returned from the ledger

E.g. Event :: Create Asset

{
    "channelName": "default",
    "chaincodeName": "supplychain",
    "eventType": "CreateAsset",
    "eventData": {
        "chaincode_id": "supplychain",
        "tx_id": "d0c1358c29c294b7ed999dc20150e286b85232a882ce101580b3edbd4a327371",
        "event_name": "CreateAsset",
        "payload": {
            "message": "Created asset id - car1.",
            "data": {
                "id": "car1",
                "assetType": "Car",
                "data": {
                    "Id": "car1",
                    "color": "red",
                    "engine": {
                        "id": 9001,
                        "isDefective": true,
                        "lotId": 123,
                        "model": "petrol"
                    },
                    "make": "ford",
                    "status": "recalled",
                    "year": 2020
                },
                "owners": [
                    {
                        "orgMSP": "641821e82c44573cb52c7d97"
                    }
                ],
                "createdAt": "2023-05-13T02:20:46.881413278+05:30",
                "updatedAt": "2023-05-16T21:27:46.015214724+05:30",
                "createdBy": {
                    "orgMSP": "Org1MSP"
                },
                "updatedBy": {
                    "orgMSP": "Org1MSP"
                }
            }
        }
    }
}

Last updated