Create an ApsaraMQ for RabbitMQ sink connector
Create a sink connector task in the ApsaraMQ for Kafka console to stream data from ApsaraMQ for Kafka to ApsaraMQ for RabbitMQ.
Prerequisites
-
You have purchased and deployed an ApsaraMQ for Kafka instance, and the instance is running. For more information, see Step 2: Purchase and deploy an instance.
-
You have purchased and deployed an ApsaraMQ for RabbitMQ instance, and the instance is in the Running state. For more information, see Step 2: Create resources.
Create a sink connector task
Log on to the ApsaraMQ for Kafka console. On the Overview page, select a region in the Resource Distribution section.
In the left-side navigation pane, choose .
On the Tasks page, click Create Task.
-
In the Create Task panel, specify the Task Name and Description, configure the following parameters, and then click Save.
-
Task creation
-
In the Source step, select Message Queue for Apache Kafka as the Data Provider. Configure the following parameters, and then click Next.
Parameter
Description
Example
Region
The region of the source Message Queue for Apache Kafka instance.
China (Beijing)
Kafka instance
The source Message Queue for Apache Kafka instance.
alikafka_post-cn-jte3****
Topic
The topic from which messages are consumed.
demo-topic
Group ID
The consumer group of the source instance.
-
Quick Create (recommended): A group ID in the
GID_EVENTBRIDGE_xxxformat is automatically created. -
Use Existing: Select an existing group ID. Do not share this group ID with other services to avoid disrupting message consumption.
Quick Create
Consumer offset
The offset from which message consumption starts.
-
Latest offset (latest)
-
Earliest offset (earliest)
Latest offset (latest)
Network configuration
The network type for routing messages.
-
Basic Network
-
Self-managed Internet
Basic Network
VPC
Required only if Network configuration is set to Self-managed Internet.
vpc-bp17fapfdj0dwzjkd****
vSwitch
Required only if Network configuration is set to Self-managed Internet.
vsw-bp1gbjhj53hdjdkg****
Security group
Required only if Network configuration is set to Self-managed Internet.
alikafka_pre-cn-7mz2****
Data Format
The encoding format for the message content. We recommend Json if you do not have specific encoding requirements.
-
Json: Encodes binary data as a JSON object into the payload using UTF-8.
-
Text: Encodes binary data as a UTF-8 string into the payload. This is the default format.
-
Binary: Encodes binary data as a Base64-encoded string into the payload.
Json
Messages
Advanced configuration parameter. The maximum number of messages per batch. A request is sent when the accumulated message count reaches this value. Valid values: 1 to 10,000.
100
Interval (Unit: Seconds)
Advanced configuration parameter. The interval, in seconds, at which messages are aggregated and sent to the sink. Valid values: 0 to 15. A value of 0 means messages are delivered immediately.
3
-
-
In the Filtering step, set the Pattern Content to filter events. For more information, see event pattern.
-
In the Transformation step, configure data transformation to perform operations such as splitting, mapping, enrichment, and dynamic routing. For more information, see Use Function Compute to clean message data.
-
In the Sink wizard, set Service Type to Message Queue for AMQP and configure the following parameters.
Parameter
Description
Example
Instance ID
Select the destination ApsaraMQ for RabbitMQ instance.
amqp-cn-zvp2pny6****
vhost
Select an existing vhost.
test
Destination Type
-
Exchange: A producer sends messages to an exchange, which then routes the messages to one or more queues.
-
Queue: Each message is delivered to one or more queues.
Queue
Exchange
The destination exchange in the ApsaraMQ for RabbitMQ instance. Required only when Destination Type is set to Exchange.
exchange
Queue
The destination queue in the ApsaraMQ for RabbitMQ instance. Required only when Destination Type is set to Queue.
queue
Message Routing Key
EventBridge uses a JSONPath expression to extract the routing key from an event. Required only when Destination Type is set to Exchange.
-
Data Extraction
-
Fixed Value
Data Extraction
$.data.keyMessage Body
EventBridge uses a JSONPath expression to extract the message body from an event.
-
Complete Data
-
Data Extraction
-
Fixed Value
-
Template
Data Extraction
$.data.bodyMessageId
EventBridge uses a JSONPath expression to extract the message ID from an event.
-
Null
-
Data Extraction
-
Fixed Value
-
Template
Data Extraction
$.data.props.messageIdEventBridge uses a JSONPath expression to extract custom properties from an event.
-
Null
-
Data Extraction
-
Template
Data Extraction
$.data.props -
-
-
Task properties
Configure the retry policy for delivery failures and specify how errors are handled. For more information, see retry policies and dead-letter queues.
-
-
Return to the Tasks page, find your task, and click Enable in the Actions column.
-
In the Note dialog box, review the information and click OK.
After you enable the task, it may take 30 to 60 seconds to start. View the startup progress in the Status column on the Tasks page.
Other operations
On the Tasks page, find the target task and perform the following operations in the Actions column:
-
Click Details to view the task's basic information, properties, and monitoring metrics on the Task page.
-
Click Edit to modify the task configuration in the Edit Task panel.
-
Click Enable or Pause, and then click OK in the Note dialog box.
-
Click Delete, and then click OK in the Note dialog box.