Creating an EG Trigger (RocketMQ Custom Event Source)
Prerequisites
Before creating a trigger, ensure that you have completed the following operations:
- You have created and enabled VPC. For details, see Creating a Function from Scratch and Configuring the Network.
- You have created an EG event channel. For details, see Creating an EG Event Channel.
- You have created a RocketMQ instance. For details, see Buying an Instance.
- You have created a RocketMQ topic. For details, see Creating a Topic.
- You have created a RocketMQ consumer group. For details, see Creating a Consumer Group.
- Currently, EG triggers are available only in AP-Bangkok, AP-Singapore, AF-Johannesburg, LA-Mexico City2, and LA-Santiago.
- The VPC bound to the function must be the same as the VPC of the RocketMQ instance. After VPC access is enabled, you need to configure corresponding subnet permissions for the RocketMQ security group.
Creating an EG Trigger
- 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 > Triggers and click Create Trigger.
Figure 1 Creating a trigger
- Set the following parameters:
- Trigger Type: Select DMS (for HC.RocketMQ).
- Trigger Name: Enter a trigger name.
- Event Channel: Select an existing channel.
- *Instance: Select a RocketMQ instance.
- Topic: Select a RocketMQ topic.
- Consumer Group: Select a RocketMQ consumer group.
- Username: This parameter is mandatory when ACL is enabled for the RocketMQ instance. Username used for accessing the RocketMQ instance.
- Password: This parameter is mandatory when ACL is enabled for the RocketMQ instance. Password for connecting to the RocketMQ instance.
- Click OK.
Configuring an EG 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 parameters 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 DMS (for HC.RocketMQ) and use the built-in HC.ROCKETMQ 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, rocketmq-123test.
Event data
The system automatically loads the built-in eg-RocketMQ 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.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot