To enable various events on a blockchain to automatically trigger your business applications or third-party services, you can configure the mapping between the events and an external HTTP service. After the mapping is configured, Alibaba Cloud Blockchain as a Service (BaaS) automatically triggers the HTTP service when a blockchain event is detected.
Configure an external HTTP service trigger
Note: Before you configure the trigger, you must install the cloud service integration module.
Find the target organization in the My Organizations section and click Cloud service integration on the right side.
Click the External HTTP service tab.
Click Add configuration. In the Add external HTTP service configuration side pane that appears, set the following parameters:
Name: the name of the trigger for easy identification.
Channel/network: the fabric channel used by the trigger to listen to and push events.
Event type: the type of events you want to push to an external service. For information about event types, see Subscribe to events.
URL: the HTTP or HTTPS address of the external service.
Method: the method used to request the URL of the external HTTP service. Both GET and POST methods are supported.
Authentication method: the authentication method you want to use. Valid values:
none: Authentication is not required.
basic: basic authentication based on the username and password.
bearer: authentication based on the HTTP bearer token.
Failure threshold: Advanced option. After the number of failure exceeds this value, the trigger enters the failed state and stops processing. -1 means the number of failure is unlimited, and the trigger will not enter the failed state.
Filter: Advanced option. Optional. For more information, see Use Filter.
Click Add. After the trigger is added, it appears in the list.
NoteNote: When a trigger pushes a blockchain event to an integrated service, a service processing error or parameter configuration error causes the trigger status to become Exception. You can move the pointer over Exception to view the error information. When the integrated service returns an exception, the trigger retries processing. If the retry fails multiple times, the trigger discards the event, which is counted as one failure. If the aggregate number of failure doesn’t exceed the failure threshold, the trigger pushes subsequent events. If the aggregate number of failure exceeds the failure threshold, the trigger enters the failed state and stops processing. You can repair the trigger or relevant service and enable it again, the failure number will return to zero. Block height field indicates the latest block has been processed by the trigger, which reflects the progress of the trigger.
After a trigger is created, you can perform the following operations:
Delete: deletes the trigger.
Disable: stops event pushes to the service for which you create the trigger.
Enable: pushes events to the service for which you create the trigger. After a trigger is enabled, it pushes the events of the latest block. The events that are generated while the trigger is disabled are discarded.