You can use event rules to filter events and route events to Function Compute. This topic describes the prerequisites and procedure for routing custom events to Function Compute. This topic also describes how to verify the results.
Prerequisites
Step 1: Create a custom event source
- Log on to the EventBridge console. In the left-side navigation pane, click Event Buses.
- In the top navigation bar, select a region. On the Event Buses page, click the name of the custom event bus that you want to manage.
- In the left-side navigation pane, click Event Sources, and then click Add Event Source.
- In the Add Custom Event Source panel, set the Name and Description parameters, select Custom Application from the Event Provider drop-down list, and then click OK.
Step 2: Create an event rule
Notice The event targets that you want to configure for an event rule must reside in the
same region as the event rule.
- Log on to the EventBridge console. In the left-side navigation pane, click Event Buses.
- In the top navigation bar, select a region. On the Event Buses page, click the name of the event bus that you want to manage.
- In the left-side navigation pane, click Event Rules. On the page that appears, click Create Rule.
- Perform the following operations in the Create Rule panel:
Step 3: Publish an event
Note If you need to republish an event that fails to be published, you must define exception
handling for a function in Function Compute. After EventBridge detects an exception that is thrown by the function, EventBridge republishes the
event to Function Compute.
Verify the results
To verify the results, you can view logs in the Function Compute console.
FAQ
How can I locate the issue if the event fails to be published?
If an event fails to be published, you can view the response to the publishing request for troubleshooting. You can go to the EventBridge console and view the related information in the Event Delivery section of the Event Trace message. Then, take appropriate measures based on the response returned.
What can I do if an event fails to be published to Function Compute and the "[500]ConnectErrorconnectiontimedout" error is returned in the response?
You can perform the following steps:
- Log on to the Function Compute console. Execute the function to which the event is routed and check the execution duration.
- If the execution duration is longer than 15s, check the network connection. If the execution duration is shorter than 15s, check whether you can access the endpoint for the region where the service to which the event is routed is deployed.
- If you cannot access the endpoints of the region where Function Compute is deployed, contact the Function Compute engineers.