After the Message Queue for RabbitMQ event source is integrated with Function Compute by using EventBridge, the Message Queue for RabbitMQ trigger (RabbitMQ trigger) can trigger associated functions. The functions can be used to perform custom operations on the messages that are published to Message Queue for RabbitMQ. This topic describes how to create a RabbitMQ trigger, configure function input parameters, and write and test code in the Function Compute console.
Overview
- Event Model
- Event Stream Model
- Event model: Each message is passed into a function as an event parameter. The event follows the specifications for CloudEvents. For information about the relationship between message content and CloudEvents, see the details of parameters.
- Event stream model: One or more messages are passed into a function in batches based on your batch configurations. This model is suitable for scenarios in which end-to-end streaming data is processed.
Usage notes
- The Message Queue for RabbitMQ instance that is the trigger source must be in the same region as the function in Function Compute.
- When the number of created custom event buses and the number of created event rules reach the upper limits, you cannot create a Message Queue for RabbitMQ trigger of the event model.
- When the number of created event streams reaches the upper limit, you cannot create a Message Queue for RabbitMQ trigger of the event stream model.
Item | Upper limit |
---|---|
Number of custom event buses | 10 |
Number of event rules created in each custom event bus | 10 |
Number of event streams | 30 |
Before you begin
- EventBridge
- Function Compute
- Message Queue for RabbitMQ
Step 1: Create a trigger
Step 2: Configure the input parameters of the function
The Message Queue for RabbitMQ event source is passed to the function in the form of event
, which acts as the input parameter. You can also manually pass event
to the function to trigger the function and test whether the code of the function
is correct.
Step 3: Write and test the function
After you create the trigger, you can write function code and test the function to verify that the code is correct. When Message Queue for RabbitMQ events are delivered to Function Compute by using EventBridge, the trigger triggers function execution.
References
To modify or delete an existing trigger, see Manage triggers.