Using a DIS Trigger
Prerequisites
Before creating a trigger, ensure that you have prepared the following:
- You have created a function. For details, see Creating a Function from Scratch.
- You have created a DIS stream.
Setting an Agency
Before creating a DIS trigger, set an agency to delegate FunctionGraph to access DIS. For details on how to create an agency, see Configuring Agency Permissions.
Since you did not specify an agency while creating the HelloWorld function, specify one first.
- Log in to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
- Click the function to be configured to go to the function details page.
- Choose Configuration > Permissions, and change the agency to serverless-trust created in Configuring Agency Permissions.
- Click Save.
Creating a DIS Trigger
- Return to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
- Click the function to be configured to go to the function details page.
- Choose Configuration > Triggers and click Create Trigger.
- Set the following parameters:
- Trigger Type: Select Data Ingestion Service (DIS).
- Stream Name: Select a DIS stream, for example, dis-function.
- Starting Position: Specify a position in the specified stream from which to start reading data.
- TRIM_HORIZON: Data is read from the earliest valid records that are stored in the partition.
- LATEST: Data is read just after the most recent record in the partition. This setting ensures that you always read the latest data.
- Pull Period: Set a period for pulling data from the stream.
- Serial Data Processing: If this option is selected, FunctionGraph pulls data from the stream only after previous data is processed. If this option is not selected, FunctionGraph pulls data from the stream as long as the pull period ends.
- Click OK.
Configuring a DIS Event to Trigger the Function
- Return to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
- Click the function to be configured to go to the function details page.
- On the function details page, select a version.
- On the Code tab page, click Test. The Configure Test Event dialog box is displayed.
- Set the parameters described in Table 1 and click Save.
Table 1 Test event information Parameter
Description
Configure Test Event
You can choose to create a test event or edit an existing one.
Use the default option Create new test event.
Event Template
Select Data Ingestion Service (DIS) to use the built-in DIS event template.
Event Name
The event name can contain 1 to 25 characters and must start with a letter and end with a letter or digit. Only letters, digits, underscores (_), and hyphens (-) are allowed. For example, dis-123test.
Event data
The system automatically loads the built-in DIS event template, which is used in this example without modifications.
- Click Test. The function test result is displayed.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.