Synchronizing data to Function Compute

Updated at:
Copy as MD

Create a message outflow task to route messages from an ApsaraMQ for RabbitMQ queue to a Function Compute function for event-driven processing.

How it works

When messages arrive in a RabbitMQ queue, the connector batches them and invokes your Function Compute function. A function invocation is triggered when either condition is met:

  • The number of accumulated messages reaches the configured batch size.

  • The configured time interval elapses.

Prerequisites

Before you begin, make sure that you have:

Create a message outflow task

  1. Log on to the ApsaraMQ for RabbitMQ console.

  2. In the left-side navigation pane, choose Connector Ecosystem Integration > Tasks.

  3. In the top navigation bar, select a region, such as China (Hangzhou).

  4. On the Tasks page, click Create Task.

  5. On the Create Task page, configure the Task Name and Description parameters.

  6. Complete the following configuration steps and click Save.

Step 1: Configure the source

In the Source step, set Data Provider to ApsaraMQ for RabbitMQ, configure the following parameters, and then click Next.

ParameterDescriptionExample
RegionThe region selected when the message sink task was created. This value cannot be changed.China (Hangzhou)
RabbitMQ InstanceThe source instance that produces messages.amqp-cn-\*\*\*\*\*\*lpc00a
vhostThe vhost on the source instance.test
QueueThe queue on the source instance to consume messages from.queue_test
MessagesThe maximum number of messages per batch. A function invocation is triggered only after this number of messages accumulates. Valid values: 1 to 10000.100
Interval (Unit: Seconds)The interval at which the function is called. The system aggregates messages and sends them to Function Compute at this interval. Valid values: 0 to 15. Set to 0 to deliver messages immediately without waiting.3

Step 2: Configure filtering

In the Filtering step, set the Pattern Content filter to control which messages are forwarded to Function Compute. See Event patterns.

Step 3: Configure transformation

In the Transformation step, configure data cleansing to apply operations such as segmentation, mapping, enrichment, and dynamic routing before messages reach your function. See Use Function Compute for message data cleansing.

Step 4: Configure the sink

In the Sink step, set Service Type to Function Compute and configure the following parameters.

ParameterDescriptionExample
ServiceThe Function Compute service.test
FunctionThe Function Compute function to invoke.test
Version and AliasThe service version or alias to use.Specified Version
VersionThe function version. Select the latest version unless a specific version is required.LATEST
Invocation ModeThe invocation mode. Valid values: Synchronous and Asynchronous.Asynchronous
EventThe event transformation method. See Event transformation.Complete Data

Step 5: Configure task properties

Configure the retry policy for failed events and the error handling method. See Retries and dead-letter queues.

Manage tasks

On the Tasks page, find the target task and use the Actions column to perform the following operations:

OperationDescription
DetailsView the source, sink, and resource configurations of the task on the Message Sink Details page.
EditModify the Resource Configuration and Rule Configuration in the Edit Message Sink panel.
Enable / DisableEnable or disable the task. Click Confirm in the Note dialog box.
DeleteDelete the task. Click Confirm in the Note dialog box.