Blockchain as a Service (BaaS) can automatically run off-chain business logic whenever a blockchain event occurs. Upload your logic to Function Compute, configure the mapping between blockchain events and your function, and BaaS will prepare computing resources and invoke the function reliably whenever a matching event is detected.
Prerequisites
Before you begin, ensure that you have:
The cloud service integration module installed
Integrate BaaS with Function Compute
Log in to the Alibaba Cloud BaaS console. In the left navigation bar, go to Hyperledger Fabric > Overview.
In the My Organizations section, find the target organization and click Cloud service integration on the right.
Click the Function Compute tab.
Click Condition detection to check the integration status.
If Function Compute is not yet enabled, click Enable service.
If BaaS is not yet authorized to access Function Compute, click Authorization Service.
When the integration is complete, the following page appears. Click Add configuration to set up an event trigger.

Configure a Function Compute trigger
Complete the integration steps above before configuring a trigger.
On the Function Compute tab, click Add configuration.
In the Add function compute configuration pane, set the following parameters:
Parameter Description Name A name for the trigger, used for identification. Channel/network The Fabric channel the trigger listens on and pushes events from. Event type The type of blockchain events to push to Function Compute. For information about event types, see Subscribe to events. Function compute domain name The endpoint of your Function Compute service. Find it on the Common Info page in the Function Compute console, or look it up in Function Compute service addresses. Service name The name of the Function Compute service that contains the target function. Function name The name of the target function. Version (Optional) The version of the target function. Failure threshold (Advanced) The maximum number of cumulative failures before the trigger enters the failed state and stops processing. Set to -1for unlimited failures (the trigger will not enter the failed state).Filter (Advanced, optional) For more information, see Use Filter. Click Add. The new trigger appears in the trigger list.

Manage triggers
After a trigger is created, you can perform the following operations:
Delete: Permanently removes the trigger.
Disable: Pauses event pushes.
ImportantEvents generated while the trigger is disabled are permanently discarded. They are not delivered when you re-enable the trigger. Plan maintenance windows carefully to avoid missing critical blockchain events.
Enable: Resumes event pushes from the latest block. If a trigger was in the failed state, the failure count resets to zero after you repair and re-enable it.
How error handling works
When a trigger pushes a blockchain event, two types of errors can occur:
Service processing error or parameter configuration error: The trigger status changes to Exception. Hover over Exception to view the error details.
Exception returned by the integrated service: The trigger retries automatically. If all retries fail, the event is discarded and counted as one failure.
The trigger then compares its cumulative failure count against the Failure threshold:
If the count is within the threshold, the trigger continues pushing subsequent events.
If the count exceeds the threshold, the trigger enters the failed state and stops processing.
After you repair the trigger or the integrated service and re-enable the trigger, the failure count resets to zero.
The Block height field shows the latest block the trigger has processed, which reflects its current progress.
What's next
Subscribe to events — learn about event types and data schemas
Use Filter — configure filter expressions to push only the events your function needs