You need to enable JavaScript to run this app.
Volcano Engine Function as a Service

Volcano Engine Function as a Service

Copy page
Download PDF
Kafka trigger
CreateKafkaTrigger
Copy page
Download PDF
CreateKafkaTrigger
Create Kafka trigger.​
Request description​
  • Request method: POST​
  • Request address: http://open.volcengineapi.com/?Action=CreateKafkaTrigger&Version=2024-06-06​
Debugging​
API Explorer
You can initiate calls online through API Explorer without paying attention to the signature generation process and quickly obtain the call results.
​
Request parameter​
​
Parameter​
Type​
Required or Not​
Sample value​
Description​
Action​
String​
Yes​
CreateKafkaTrigger​
Interface name. The current API is called CreateKafkaTrigger.​
Version​
String​
Yes​
2024-06-06​
Interface version. The current version of the API is 2024-06-06.​
FunctionId​
String​
Yes​
wrw******​
Function ID. You can call the ListFunctions interface to obtain function ID (Items.Id).​
Name​
String​
Yes​
reviews-consumer​
Kafka trigger name.​
  • Trigger names cannot be repeated under the same function.​
  • Contains only uppercase and lowercase letters, numbers, and underscores (_), and starts with a letter, with a length limit of 4 to 63 characters.​
Description​
String​
No​
Example Kafka trigger​
Kafka trigger description. The length is limited to 200 characters.​
MqInstanceId​
String​
Yes​
kafka-cnngl4ifv******​
Message queue Kafka instance ID. You can call the DescribeInstances interface to obtain Kafka instance ID.​
TopicName​
String​
Yes​
reviews-topic​
Topic name of the message queue Kafka instance. You can call the DescribeTopics interface to obtain the Topic name of the Kafka instance.​
Enabled​
Boolean​
No​
true​
Whether to enable trigger while creating trigger. Value:​
  • true : enable.​
  • false: turn off.​
tip​
Only the trigger enabled can work properly.​
StartingPosition​
String​
No​
Latest​
Specify the location of the message when starting consuming messages in the Topic. Value:​
  • Latest: Only consume messages generated after subscribing to the Topic.​
  • Earliest: Start consuming from the first message produced in the Topic.​
MaximumRetryAttempts​
Integer​
No​
100​
The maximum number of retries when a function has running errors (including user code errors and Runtime errors). A positive integer with values ranging from 0 to 100.​
KafkaCredentials​
Object of KafkaCredentials​
Yes​
​
Kafka identity authentication. Function as a Service authenticates message consumption for both PLAIN and SCRAM-SHA-256 types of SASL users through the Kafka ACL permission policy.​
BatchSize​
Integer​
No​
10​
The number of messages per batch for batch consumption of trigger. It is recommended that the value does not exceed 1,000.​
BatchFlushDurationMilliseconds​
Integer​
No​
1000​
The maximum waiting time for batch consumption of trigger. The unit is millisecond (ms), and the value range is 1,000-60,000 ms. The default value is 1,000 ms.​
warning​
This parameter only takes effect when the BatchSize parameter has been already configured.​
​
KafkaCredentials​
​
Parameter​
Type​
Required or Not​
Sample value​
Description​
Password​
String​
Yes​
xxxxxxxxxx​
The SASL/PLAIN user password set when creating Kafka instances. You can call the DescribeUsers interface to obtain Kafka instances SASL/PLAIN user password.​
Username​
String​
Yes​
demo-name​
The SASL/PLAIN user name set when creating the Kafka instance. You can call the DescribeUsers interface to obtain the Kafka instance SASL/PLAIN user name.​
Mechanism​
String​
Yes​
PLAIN​
Kafka authentication mechanism. Value:​
  • PLAIN​
  • SCRAM-SHA-256​
​
Sample request​
​
POST http://open.volcengineapi.com/?Action=CreateKafkaTrigger&Version=2024-06-06 HTTP/1.1​
Content-Type: application/json​
{​
"FunctionId": "wrw ******",​
"Name": "reviews-consumer",​
"Description": "Sample kafka Trigger",​
"MqInstanceId": "kafka-cnngl4ifv******",​
"TopicName": "reviews-topic",​
"Enabled": true,​
"StartingPosition": "Latest",​
"MaximumRetryAttempts": 100,​
"KafkaCredentials": {​
"Mechanism": "PLAIN",​
"Username": "demo-name",​
"Password": "xxxxxxxxxx"​
}​
}​
​
Response parameter​
​
Parameter​
Type​
Sample value​
Description​
FunctionId​
String​
wrw******​
Function ID.​
Name​
String​
reviews-consumer​
Kafka trigger name.​
Description​
String​
Example Kafka trigger​
Kafka trigger description.​
Enabled​
Boolean​
true​
Whether to enable Kafka trigger. Parameter value description:​
  • true: enable​
  • false: turn off​
MqInstanceId​
String​
kafka-cnngl4if******​
Message queue Kafka instance ID.​
TopicName​
String​
reviews-topic​
Topic name of the message queue Kafka instance.​
StartingPosition​
String​
Latest​
Start consuming the location of the message in the Topic. Parameter value description:​
  • Latest: Only consume messages generated after subscribing to the Topic.​
  • Earliest: Start consuming from the first message produced in the Topic.​
MaximumRetryAttempts​
Integer​
100​
The maximum number of retries when a function has running errors.​
Id​
String​
18lt****​
Kafka trigger ID.​
ConsumerGroup​
String​
reviews-topic_18lt****​
The consumption group name of message queue Kafka instance.​
Status​
String​
pending​
Kafka trigger status. Parameter value description:​
  • ready: Running​
  • failed: Failed​
  • pending: Starting​
CreationTime​
String​
2025-02-03 06:47:41.423691239 +0000 UTC​
The creation time for Kafka trigger. ​
UTC + 0 time in standard RFC 3339 format.​
LastUpdateTime​
String​
2025-02-03 06:47:41.423691239 +0000 UTC​
The latest update time for Kafka trigger. UTC + 0 time in standard RFC3339 format.​
BatchSize​
Integer​
10​
The number of messages per batch for batch consumption of trigger.​
BatchFlushDurationMilliseconds​
Integer​
1000​
The maximum waiting time for batch consumption of trigger. The unit is millisecond.​
​
Sample response​
​
HTTP/1.1 200 OK​
Content-Type: application/json​
{​
"ResponseMetadata": {​
"RequestId": "20230604110420****100232280022D31",​
"Action": "CreateKafkaTrigger",​
"Version": "2024-06-06",​
"Service": "vefaas",​
"Region": "cn-Beijing"​
},​
"Result": {​
"FunctionId": "wrw ******",​
"Name": "reviews-consumer",​
"Description": "Sample kafka Trigger",​
"Enabled": true,​
"MqInstanceId": "kafka-cnngl4if******",​
"TopicName": "reviews-topic",​
"StartingPosition": "Latest",​
"MaximumRetryAttempts": 100,​
"Id": "18lt ****",​
"ConsumerGroup": "reviews- topic_18lt ****",​
"Status": "pending",​
"CreationTime": "2025-02-03 06:47:41.423691239 + 0000 UTC",​
"LastUpdateTime": "2025-02-03 06:47:41.423691239 + 0000 UTC"​
}​
}​
​
Error code​
The current interface temporarily has no independent error code. If the interface calls back abnormally, you can refer to Public error code to troubleshoot.​
Last updated: 2025.06.30 11:37:43