DMS (for RabbitMQ) Trigger
This section describes how to create a RabbitMQ trigger (only the fan-out exchange mode is supported) to enable FunctionGraph to periodically poll for new messages in a specific topic bound to the exchange of a RabbitMQ instance and pass the messages as input parameters to invoke functions.
For details about the RabbitMQ event source, see Supported Event Sources.
Notes and Constraints
RabbitMQ triggers are available only in the following regions: CN North-Beijing4, CN East-Shanghai1, AP-Bangkok, AP-Singapore, LA-Mexico City2, and LA-Sao Paulo1. You can check whether the trigger type is supported on the console.
Prerequisites
- Function and configuration:
- You have created a function.
- You have configured DMS agency permissions for the function. For details about how to create an agency, see Configuring Agency Permissions.
- You have enabled the VPC access for the function and configured the subnet permissions for the RabbitMQ security group. For details, see Configuring Networks.
- DMS for RabbitMQ:
- A RabbitMQ instance has been created. For details, see Buying an Instance.
- A virtual host, exchange, and queue have been created.
- To create a virtual host, see Creating a RabbitMQ Virtual Host.
- To create an exchange, see Creating a RabbitMQ Exchange.
- To create a queue, see Creating a RabbitMQ Queue.
- An exchange-queue binding has been configured. For details, see Binding a RabbitMQ Exchange and Binding a RabbitMQ Queue.
Virtual hosts (vhost) serve as independent RabbitMQ servers to manage exchanges and queues. A RabbitMQ instance can have multiple virtual hosts, and a virtual host can have multiple exchanges and queues. For details, see Process of Using RabbitMQ.
- The rules of the security group of the instance have been correctly configured.
- In the Network section on the Basic Information tab page, click the name of the security group.
- Click the Inbound Rules tab to view the inbound rules of the security group.
- SSL disabled
For intra-VPC access, inbound access through port 5672 must be allowed.
For public access, inbound access through port 15672 must be allowed.
- SSL enabled
For intra-VPC access, inbound access through port 5671 must be allowed.
For public access, inbound access through port 15671 must be allowed.
- SSL disabled
Creating a RabbitMQ 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
- Configure the following parameters.
Table 1 RabbitMQ trigger parameters Parameter
Description
Example Value
Trigger Type
Mandatory.
Select DMS (for RabbitMQ).
DMS (for RabbitMQ)
Instance
Mandatory.
Select a created RabbitMQ instance. If no instance is available, click Create Instance.
rabbitmq-fg
Password
Mandatory.
Enter the password of the created RabbitMQ instance.
testrabbitmq
Exchange
Mandatory.
Enter the name of the created exchange. For details, see 2.
rabbitmqEX
Virtual Host
Optional.
Enter the name of the virtual host you have created. For details, see 1.
test
Batch Size
Mandatory.
Enter the number of messages consumed from the topic each time. The value ranges from 1 to 1000.
100
- Click OK.
Configuring a DMS (for RabbitMQ) Event to Trigger the Function
- Return to the FunctionGraph console. In the navigation pane, choose Functions > Function List.
- Click the name of the function to be configured. The function details page is displayed.
- 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 2 and click Save.
Table 2 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 Templates
Select DMS (for RabbitMQ) to use the built-in RabbitMQ 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, rabbitmq-123test.
Event data
The system automatically loads the built-in RabbitMQ event template, which is used in this example without modifications.
- Click Test. The function test result is displayed.
Helpful Links
Manage function triggers through APIs. For details, see Function Trigger APIs.
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