tencent cloud

Serverless Cloud Function

Release Notes and Announcements
Release Notes
Announcements
User Guide
Product Introduction
Overview
Related Concepts
How It Works
Strengths
Scenarios
Related Products
Purchase Guide
Billing Overview
Billing Mode
Billable Items and Billing Modes
Function Computing Power Support
Free Tier
SCF Pricing
Billing Example
Payment Overdue
Getting Started
Creating Event Function in Console
User Guide
Quota Management
Managing Functions
Web Function Management
Log Management
Concurrence Management
Trigger Management
Function URL
A Custom Domain Name
Version Management
Alias Management
Permission Management
Running Instance Management
Plugin Management
Managing Monitors and Alarms
Network Configuration
Layer Management
Execution Configuration
Extended Storage Management
DNS Caching Configuration
Resource Managed Mode Management
Near-Offline Resource Hosting Model
Workflow
Triggers
Trigger Overview
Trigger Event Message Structure Summary
API Gateway Trigger
COS Trigger
CLS Trigger
Timer Trigger
CKafka Trigger
Apache Kafka Trigger
MQTT Trigger
Trigger Configuration Description
MPS Trigger
CLB Trigger Description
TencentCloud API Trigger
Development Guide
Basic Concepts
Testing a Function
Environment Variables
Dependency Installation
Using Container Image
Error Types and Retry Policies
Dead Letter Queue
Connecting SCF to Database
Automated Deployment
Cloud Function Status Code
Common Errors and Solutions
Developer Tools
Serverless Web IDE
Calling SDK Across Functions
Third-Party Tools
Code Development
Python
Node.js
Golang
PHP
Java
Custom Runtime
Deploying Image as Function
Web Framework Development
Deploying Framework on Command Line
Quickly Deploying Egg Framework
Quickly Deploying Express Framework
Quickly Deploying Flask Framework
Quickly Deploying Koa Framework
Quickly Deploying Laravel Framework
Quickly Deploying Nest.js Framework
Quickly Deploying Next.js Framework
Quickly Deploying Nuxt.js Framework
Quickly Deploying Django Framework
Use Cases
Overview
Solutions with Tencent Cloud Services
Business Development
TRTC Practices
COS Practices
CKafka Practice
CLS
CLB Practice
MPS
CDN
CDWPG
VOD
SMS
ES
Scheduled Task
Video Processing
Success Stories
Tencent Online Education
Online Video Industry
Tencent Online Education
Best Practice of Tencent IEG Going Global
API Documentation
History
Introduction
API Category
Making API Requests
Other APIs
Namespace APIs
Layer Management APIs
Async Event Management APIs
Trigger APIs
Function APIs
Function and Layer Status Description
Data Types
Error Codes
SDK Documentation
FAQs
General
Web Function
Billing FAQs
Network FAQs
Log FAQs
SCF utility class
Event Handling FAQs
API Gateway Trigger FAQs
Related Agreement
Service Level Agreement
Contact Us
Glossary

Usage

PDF
フォーカスモード
フォントサイズ
最終更新日: 2024-12-25 10:34:25
This document provides a guide on creating a self-built Apache Kafka trigger and calling the function, using the example of cross-region consumption of a CKafka cluster.

Prerequisites

The function has been created.
The Kafka cluster and topic have been created.

Directions

Step 1: Creating an Apache Kafka Trigger

1. Log in to the Serverless Console and click Function Service in the left sidebar.
2. At the top of the main interface, select the region and namespace where the function is located. Then, click the function name in the list to access the function details page.
3. In the left sidebar, choose Trigger Management and click Create trigger.
4. In the Create Trigger panel, select Apache Kafka Trigger and fill in the relevant trigger information, as shown below:

Configuration Item
Operation
Example in this Document
Trigger version/alias
The default value is Default, but it can also be switched to an alias or other versions of the published function.
Default
Trigger method
Apache Kafka trigger.
Apache Kafka trigger
Trigger name
Enter a custom trigger name.
scf-kafka-1728981649432
Bootstrap Servers
Enter the host and port addresses of the Kafka instance to be accessed. Multiple entries are allowed.
11.135.x.x:7661
Topic
Select the topic of the existing Kafka instance.
test1015
Consumer Group
The desired consumer group name. If the consumer group already exists under the topic, it will continue consuming from that group; otherwise, a consumer group will be created.
A new consumer group, test1015, is used here.
Security protocol
The security protocol applied by the Kafka instance. The available values are as follows:
PLAINTEXT
SASL_SSL
SASL_PLAINTEXT
SASL_PLAINTEXT
Identity verification mechanism
The authentication mechanism used by the Kafka instance. The available values are as follows:
None
PLAIN
SCRAM-SHA-256
SCRAM-SHA-512
PLAIN
Username
When authentication in the mechanism requires verification through username and password information, you need to configure the Apache Kafka username for authentication.
admin
Password
When the authentication mechanism requires username and password verification, the Apache Kafka username should be configured for authentication.
******
Maximum messages
The maximum number of messages to be pulled and delivered to SCF in a single batch, with a current maximum configuration of 10,000. Due to factors such as message size and write speed, the actual number of messages delivered during each trigger may not always reach the maximum value, but will vary between 1 and the specified maximum batch size.
1
Consumption start point
Select the consumption offset for messages. Currently, it supports consuming from the latest position.
Latest position
Retry attempts
The maximum number of retries when the function encounters execution errors (including user code errors and execution errors). The maximum supported configuration is 10,000.
1
Max waiting time
The longest waiting time for one trigger. For example, if the user configures the maximum batch size as 1,000 messages and the maximum waiting time as 60 seconds, the function will be triggered if 1,000 messages are collected within 10 seconds. If only 50 messages are collected after 60 seconds, the function will still be triggered.
1
Trigger status
Indicates whether the trigger is enabled immediately after creation. By default, the trigger is enabled, meaning it will be activated as soon as it is created.
Enable the trigger
5. Click Submit.

Step 2: Checking the Trigger Status

After the trigger is successfully created, go to the Trigger Management page to check the trigger status, as shown below:

The system will automatically create a consumer group and bind the subscription relationship. As shown below:


Step 3: Kafka Message Consumption and Testing

1. Deliver messages to Kafka, as shown below:

2. On the function details page, select the Log Query tab and search for the function execution records. You will then be able to see that the function has been successfully consumed and triggered.




ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック