The content and structure of the event parameter of different triggers in Function Compute vary based on the specific trigger events. When a function is invoked, the corresponding business logic is implemented based on information in event.
Usage notes
The trigger events of triggers, which is passed in the form of event, must be parsed before you can use it. For more information about the sample code that is used to parse the event parameter, see Example 1: Parse JSON-formatted parameters.
HTTP triggers
The function signatures for HTTP triggers are request and response objects, instead of event objects. Therefore, HTTP triggers do not follow the event formats. For more information, see Configure an HTTP trigger.
Time triggers
{
"triggerTime":"2023-12-26T07:49:00Z",
"triggerName":"timer-trigger",
"payload":"awesome-fc"
} Parameter | Type | Example | Description |
triggerTime | String | 2023-12-26T07:49:00Z | The time when the function is triggered. |
triggerName | String | timer-trigger | The name of the time trigger. |
payload | String | awesome-fc | The custom value that you specified for the Trigger Message parameter when you created the trigger. |
OSS triggers
{
"events": [
{
"eventName": "ObjectCreated:PutObject",
"eventSource": "acs:oss",
"eventTime": "2022-08-13T06:45:43.000Z",
"eventVersion": "1.0",
"oss": {
"bucket": {
"arn": "acs:oss:cn-hangzhou:123456789:testbucket",
"name": "testbucket",
"ownerIdentity": "164901546557****"
},
"object": {
"deltaSize": 122539,
"eTag": "688A7BF4F233DC9C88A80BF985AB****",
"key": "source/a.png",
"objectMeta": {
"mimeType": "application/zip",
"userMeta": {
"x-oss-meta-last-modified":"20250213"
}
},
"size": 122539
},
"ossSchemaVersion": "1.0",
"ruleId": "9adac8e253828f4f7c0466d941fa3db81161****"
},
"region": "cn-hangzhou",
"requestParameters": {
"sourceIPAddress": "140.205.XX.XX"
},
"responseElements": {
"requestId": "58F9FF2D3DF792092E12044C"
},
"userIdentity": {
"principalId": "164901546557****"
}
}
]
}The following table describes the parameters in an event object.
Parameter | Type | Example | Description |
eventName | String | ObjectCreated:PutObject | The type of the event. |
eventSource | String | acs:oss | The event source. The value is fixed to |
eventTime | String | 2022-08-13T06:45:43.000Z | The time when the event occurred. The value is in the ISO 8601 standard time format. |
eventVersion | String | 1.0 | The version number of the event protocol. |
oss | Map | The content of the event. | |
bucket | Map | The details of the bucket. | |
name | String | testbucket | The bucket name. |
arn | String | acs:oss:cn-hangzhou:123456789:testbucket | The Alibaba Cloud Resource Name (ARN) of the bucket. |
ownerIdentity | String | 164901546557**** | The ID of the user who created the bucket. |
object | Map | The details of the object. | |
size | Int | 122539 | The object size. Unit: bytes. |
deltaSize | Int | 122539 | The variation of the object size. Unit: bytes.
|
eTag | String | 688A7BF4F233DC9C88A80BF985AB**** | The object tag. |
key | String | source/a.png | The object name. |
objectMeta | Map | The details of the objectMeta parameter. | |
mimeType | String | application/zip | The object type. For more information, see How do I configure the Content-Type header? |
userMeta | Map | The user metadata. It identifies the purposes or attributes of the object. | |
x-oss-meta-last-modified | String | 20250213 | User metadata consists of a set of key-value pairs. The name of a user metadata header must start with |
ossSchemaVersion | String | 1.0 | The version number of the OSS schema. |
ruleId | String | 9adac8e253828f4f7c0466d941fa3db81161**** | The ID of the rule that matches the event. |
region | String | cn-hangzhou | The region in which the bucket resides. |
requestParameters | Map | The request parameters. | |
sourceIPAddress | String | 140.205.XX.XX | The IP address from which the request is sent. |
responseElements | Map | The details of the response. | |
requestId | String | 58F9FF2D3DF792092E12044C | The request ID. |
userIdentity | Map | The user attributes. | |
principalId | String | 164901546557**** | The ID of the Alibaba Cloud account that initiated the request. |
Simple Log Service triggers
{
"parameter": {},
"source": {
"endpoint": "http://cn-hangzhou-intranet.log.aliyuncs.com",
"projectName": "aliyun-fc-cn-hangzhou-2238f0df-a742-524f-9f90-976ba457****",
"logstoreName": "function-log",
"shardId": 0,
"beginCursor": "MTUyOTQ4MDIwOTY1NTk3ODQ2Mw==",
"endCursor": "MTUyOTQ4MDIwOTY1NTk3ODQ2NA=="
},
"jobName": "1f7043ced683de1a4e3d8d70b5a412843d81****",
"taskId": "c2691505-38da-4d1b-998a-f1d4bb8c****",
"cursorTime": 1529486425
} Parameter | Description | Example |
parameter | The value of the Invocation Parameters parameter that you configure when you create the trigger. | N/A |
source | The log block information that you want the function to read from Simple Log Service.
| |
jobName | The name of an ETL job in Simple Log Service. Simple Log Service triggers must correspond to ETL jobs in Simple Log Service. | 1f7043ced683de1a4e3d8d70b5a412843d81**** |
taskId | For an ETL job, the taskId parameter specifies the identifier for a function invocation. | c2691505-38da-4d1b-998a-f1d4bb8c**** |
cursorTime | The UNIX timestamp of the time when the last log arrives at Simple Log Service. | 1529486425 |
Alibaba Cloud CDN triggers
Example of the LogFileCreated event
Replace
filePathwith the path of Alibaba Cloud CDN logs or a test file.{ "events": [ { "eventName": "LogFileCreated", "eventSource": "cdn", "region": "cn-hangzhou", "eventVersion": "1.0.0", "eventTime": "2018-06-14T15:31:49+08:00", "traceId": "c6459282-6a4d-4413-894c-e4ea3968****", "userIdentity": { "aliUid": "164901546557****" }, "resource": { "domain": "example.com" }, "eventParameter": { "domain": "example.com", "endTime": 1528959900, "fileSize": 1788115, "filePath": "http://cdnlog.cn-hangzhou.oss.aliyun-inc.com/www.aliyun.com/2017_12_27/www.aliyun.com_2017_12_27_0800_0900.gz?OSSAccessKeyId=xxxx&Expires=xxxx&Signature=xxxx", "startTime": 1528959600 } } ] }The following table describes the fields in the event parameter.
Parameter
Type
Example
Description
eventName
String
LogFileCreated
The event type.
eventSource
String
cdn
The name of the event source.
region
String
cn-hangzhou
The region of the Alibaba Cloud CDN.
eventVersion
String
1.0.0
The version of the event trigger.
eventTime
String
2018-06-14T15:31:49+08:00
The time at which an event occurred.
traceId
String
c6459282-6a4d-4413-894c-e4ea3968****
The ID that is delivered by the event source for troubleshooting.
userIdentity
Map
The information about the user.
aliUid
String
164901546557****
The ID of the Alibaba Cloud account that created the namespace.
resource
Map
The information about the resources.
domain
String
example.com
The endpoint.
eventParameter
Map
The event parameters.
domain
String
example.com
The endpoint.
endTime
String
1528959900
The end time of the log file.
fileSize
String
1788115
The size of the log file.
filePath
String
http://cdnlog.cn-hangzhou.oss.aliyun-inc.com/www.aliyun.com/2017_12_27/www.aliyun.com_2017_12_27_0800_0900.gz?OSSAccessKeyId=xxxx&Expires=xxxx&Signature=xxxx
The location of the log file.
startTime
String
1528959600
The start time of the log file.
Examples of event for the CachedObjectsRefreshed and CachedObjectsPushed events
{ "events": [ { "eventName": "CachedObjectsRefreshed", "eventVersion": "1.0.0", "eventSource": "cdn", "region": "cn-hangzhou", "eventTime": "2018-03-16T14:19:55+08:00", "traceId": "cf89e5a8-7d59-4bb5-a33e-4c3d08e2****", "resource": { "domain": "example.com" }, "eventParameter": { "objectPath": [ "/2018/03/16/13/33b430c57e7.mp4", "/2018/03/16/14/4ff6b9bd54d.mp4" ], "createTime": 1521180769, "domain": "example.com", "completeTime": 1521180777, "objectType": "File", "taskId": 2089687230 }, "userIdentity": { "aliUid": "164901546557****" } } ] }The following table describes the fields in the event parameter.
Parameter
Type
Example
Description
eventName
String
CachedObjectsRefreshed
The event type.
eventSource
String
cdn
The name of the event source.
region
String
cn-hangzhou
The region of the Alibaba Cloud Content Delivery Network.
eventVersion
String
1.0.0
The version of the event trigger.
eventTime
String
2018-06-14T15:31:49+08:00
The time at which an event occurred.
traceId
String
c6459282-6a4d-4413-894c-e4ea3968****
The ID that is delivered by the event source for troubleshooting.
resource
Map
The information about the resources.
domain
String
example.com
The endpoint.
eventParameter
Map
The event parameters.
objectPath
String
/2018/03/16/13/33b430c57e7.mp4
The resource identifier.
createTime
String
1521180769
The start time of the refresh.
domain
String
example.com
The endpoint.
completeTime
String
1521180777
The end time of the refresh.
objectType
String
File
The item that is refreshed. Valid values:
File: files
Directory: folders
taskId
String
2089687230
The ID of the resource refresh task.
userIdentity
Map
The information about the user.
aliUid
String
164901546557****
The ID of the Alibaba Cloud account that created the namespace.
Samples of CdnDomainStarted and CdnDomainStopped events
{ "events": [ { "eventName": "CdnDomainStarted", "eventVersion": "1.0.0", "eventSource": "cdn", "region": "cn-hangzhou", "eventTime": "2018-03-16T14:19:55+08:00", "traceId": "cf89e5a8-7d59-4bb5-a33e-4c3d08e2****", "resource": { "domain": "example.com" }, "eventParameter": { "domain": "example.com", "status": "online" }, "userIdentity": { "aliUid": "164901546557****" } } ] }The following table describes the fields in the event parameter.
Parameter
Type
Example
Description
eventName
String
CdnDomainStarted
The event type.
eventSource
String
cdn
The name of the event source.
region
String
cn-hangzhou
The region of the Alibaba Cloud CDN.
eventVersion
String
1.0.0
The version of the event trigger.
eventTime
String
2018-06-14T15:31:49+08:00
The time at which an event occurred.
traceId
String
c6459282-6a4d-4413-894c-e4ea3968****
The ID that is delivered by the event source for troubleshooting.
resource
Map
The information about the resources.
domain
String
example.com
The endpoint.
eventParameter
Map
The event parameters.
domain
String
example.com
The endpoint.
status
String
online
The status of the accelerated domain name.
userIdentity
Map
The information about the user.
aliUid
String
164901546557****
The ID of the Alibaba Cloud account that created the namespace.
Samples of CdnDomainAdded and CdnDomainDeleted events
{ "events": [ { "eventName": "CdnDomainAdded", "eventVersion": "1.0.0", "eventSource": "cdn", "region": "cn-hangzhou", "eventTime": "2018-03-16T14:19:55+08:00", "traceId": "cf89e5a8-7d59-4bb5-a33e-4c3d08e2****", "resource": { "domain": "example.com" }, "eventParameter": { "domain": "example.com" }, "userIdentity": { "aliUid": "164901546557****" } } ] }The following table describes the fields in the event parameter.
Parameter
Type
Example
Description
eventName
String
CdnDomainAdded
The event type.
eventSource
String
cdn
The name of the event source.
region
String
cn-hangzhou
The region of the Alibaba Cloud CDN.
eventVersion
String
1.0.0
The version of the event trigger.
eventTime
String
2018-06-14T15:31:49+08:00
The time at which an event occurred.
traceId
String
c6459282-6a4d-4413-894c-e4ea3968****
The ID that is delivered by the event source for troubleshooting.
resource
Map
The information about the resources.
domain
String
example.com
The endpoint.
eventParameter
Map
The event parameters.
domain
String
example.com
The endpoint.
userIdentity
Map
The information about the user.
aliUid
String
164901546557****
The ID of the Alibaba Cloud account that created the namespace.
Tablestore triggers
{
"Version": "Sync-v1",
"Records": [
{
"Type": "PutRow",
"Info": {
"Timestamp": 1506416585740836
},
"PrimaryKey": [
{
"ColumnName": "pk_0",
"Value": 1506416585881590900
},
{
"ColumnName": "pk_1",
"Value": "2017-09-26 17:03:05.8815909 +0800 CST"
},
{
"ColumnName": "pk_2",
"Value": 1506416585741000
}
],
"Columns": [
{
"Type": "Put",
"ColumnName": "attr_0",
"Value": "hello_table_store",
"Timestamp": 1506416585741
},
{
"Type": "Put",
"ColumnName": "attr_1",
"Value": 1506416585881590900,
"Timestamp": 1506416585741
}
]
}
]
}Parameter | Description |
Version | The version of the payload. Example: Sync-v1. The value is a string. |
Records | The array that stores the rows of incremental data in the table. Each element contains the following parameters:
|
PrimaryKey | The array that stores the primary key columns. Each element contains the following parameters:
|
Columns | The array that stores the attribute columns. Each element contains the following parameters:
|
MNS topic triggers
Examples on the format of the event content if you set the Event Format parameter to STREAM for an Simple Message Queue (formerly MNS) topic trigger:
The following sample code provides an example on the format of the event content if messages do not contain message attributes:
NoteIf messages do not contain message attributes, the content of the event is a string in the JSON format.
# The message body. 'hello topic'The following sample code provides an example on the format of the event content if messages contain message attributes:
NoteThe content of the event contains the key-value pairs that are related to message attributes. For more information, see PublishMessage.
{ "body": "hello topic", "attrs": { "Extend": "{\\"key\\":\\"value\\"}" } }
Examples on the format of the event content if you set the Event Format parameter to JSON for an Simple Message Queue (formerly MNS) topic trigger:
The following sample code provides an example on the format of the event content if messages do not contain message attributes:
{ "TopicOwner": "118620210433****", "Message": "hello topic", "Subscriber": "118620210433****", "PublishTime": 1550216480040, "SubscriptionName": "test-fc-subscribe", "MessageMD5": "BA4BA9B48AC81F0F9C66F6C909C3****", "TopicName": "Mytopic", "MessageId": "2F5B3C082B923D4EAC694B76D928****" }The following sample code provides an example on the format of the event content if messages contain message attributes:
NoteThe content of the event contains the key-value pairs that are related to message attributes. For more information, see PublishMessage.
{ "key": "value", "TopicOwner": "118620210433****", "Message": "hello topic", "Subscriber": "118620210433****", "PublishTime": 1550216302888, "SubscriptionName": "test-fc-subscribe", "MessageMD5": "BA4BA9B48AC81F0F9C66F6C909C3****", "TopicName": "Mytopic", "MessageId": "2F5B3C281B283D4EAC694B742528****" }
The following table describes parameters of the event.
Parameter | Type | Example | Description |
key | String | value | The key-value pairs that are related to message attributes. |
TopicOwner | String | 118620210433**** | The account ID of the Simple Message Queue (formerly MNS) topic owner. |
Message | String | hello topic | The content of the message. |
Subscriber | String | 118620210433**** | The account ID of the user who subscribes to the Simple Message Queue (formerly MNS) topic. |
PublishTime | Int | 1550216302888 | The time when the message was published. |
SubscriptionName | String | test-fc-subscribe | The name of the subscription. |
MessageMD5 | String | BA4BA9B48AC81F0F9C66F6C909C3**** | The MD5 hash value of the message body. |
TopicName | String | Mytopic | The name of the Simple Message Queue (formerly MNS) topic. |
MessageId | String | 2F5B3C281B283D4EAC694B742528**** | The message ID. |
MNS queue triggers
Sample code of event:
[
{
"id":"c2g71017-6f65-fhcf-a814-a396fc8d****",
"source":"MNS-Function-mnstrigger",
"specversion":"1.0",
"type":"mns:Queue:SendMessage",
"datacontenttype":"application/json; charset=utf-8",
"subject":"acs:mns:cn-hangzhou:164901546557****:queues/zeus",
"time":"2021-04-08T06:28:17.093Z",
"aliyunaccountid":"164901546557****",
"aliyunpublishtime":"2021-10-15T07:06:34.028Z",
"aliyunoriginalaccountid":"164901546557****",
"aliyuneventbusname":"MNS-Function-mnstrigger",
"aliyunregionid":"cn-chengdu",
"aliyunpublishaddr":"42.120.XX.XX",
"data":{
"requestId":"606EA3074344430D4C81****",
"messageId":"C6DB60D1574661357FA227277445****",
"messageBody":"TEST"
}
},
{
"id":"d2g71017-6f65-fhcf-a814-a396fc8d****",
"source":"MNS-Function-mnstrigger",
"specversion":"1.0",
"type":"mns:Queue:SendMessage",
"datacontenttype":"application/json; charset=utf-8",
"subject":"acs:mns:cn-hangzhou:164901546557****:queues/zeus",
"time":"2021-04-08T06:28:17.093Z",
"aliyunaccountid":"164901546557****",
"aliyunpublishtime":"2021-10-15T07:06:34.028Z",
"aliyunoriginalaccountid":"164901546557****",
"aliyuneventbusname":"MNS-Function-mnstrigger",
"aliyunregionid":"cn-chengdu",
"aliyunpublishaddr":"42.120.XX.XX",
"data":{
"requestId":"606EA3074344430D4C81****",
"messageId":"C6DB60D1574661357FA227277445****",
"messageBody":"TEST"
}
}
]The following table describes the parameters contained in data. For information about parameters that are defined in the CloudEvents specification, see Overview.
Parameter | Required | Example | Description |
requestId | String | 606EA3074344430D4C81**** | The request ID. The ID of each request is unique. |
messageId | String | C6DB60D1574661357FA227277445**** | The message ID. The ID of each message is unique. |
messageBody | String | TEST | The message body. |
ApsaraMQ for RocketMQ triggers
Sample code of event:
[
{
"id":"94ebc15f-f0db-4bbe-acce-56fb72fb****",
"source":"RocketMQ-Function-rocketmq-trigger",
"specversion":"1.0",
"type":"mq:Topic:SendMessage",
"datacontenttype":"application/json; charset=utf-8",
"subject":"acs:mq:cn-hangzhou:164901546557****:MQ_INST_164901546557****_BXhFHryi%TopicName",
"time":"2021-04-08T06:01:20.766Z",
"aliyunaccountid":"164901546557****",
"aliyunpublishtime":"2021-10-15T02:05:16.791Z",
"aliyunoriginalaccountid":"164901546557****",
"aliyuneventbusname":"RocketMQ-Function-rocketmq-trigger",
"aliyunregionid":"cn-chengdu",
"aliyunpublishaddr":"42.120.XX.XX",
"data":{
"topic":"TopicName",
"systemProperties":{
"MIN_OFFSET":"0",
"TRACE_ON":"true",
"MAX_OFFSET":"8",
"MSG_REGION":"cn-hangzhou",
"KEYS":"systemProperties.KEYS",
"CONSUME_START_TIME":1628577790396,
"TAGS":"systemProperties.TAGS",
"INSTANCE_ID":"MQ_INST_164901546557****_BXhFHryi"
},
"userProperties":{
},
"body":"TEST"
}
},
{
"id":"94ebc15f-f0db-4bbe-acce-56fb72fb****",
"source":"RocketMQ-Function-rocketmq-trigger",
"specversion":"1.0",
"type":"mq:Topic:SendMessage",
"datacontenttype":"application/json; charset=utf-8",
"subject":"acs:mq:cn-hangzhou:164901546557****:MQ_INST_164901546557****_BXhFHryi%TopicName",
"time":"2021-04-08T06:01:20.766Z",
"aliyunaccountid":"164901546557****",
"aliyunpublishtime":"2021-10-15T02:05:16.791Z",
"aliyunoriginalaccountid":"164901546557****",
"aliyuneventbusname":"RocketMQ-Function-rocketmq-trigger",
"aliyunregionid":"cn-chengdu",
"aliyunpublishaddr":"42.120.XX.XX",
"data":{
"topic":"TopicName",
"systemProperties":{
"MIN_OFFSET":"0",
"TRACE_ON":"true",
"MAX_OFFSET":"8",
"MSG_REGION":"cn-hangzhou",
"KEYS":"systemProperties.KEYS",
"CONSUME_START_TIME":1628577790396,
"TAGS":"systemProperties.TAGS",
"INSTANCE_ID":"MQ_INST_164901546557****_BXhFHryi"
},
"userProperties":{
},
"body":"TEST"
}
}
]The following table describes the parameters contained in data. For information about parameters that are defined in the CloudEvents specification, see Overview.
Parameter | Type | Example | Description |
topic | String | TopicName | The topic name. |
systemProperties | Map | The system properties. | |
MIN_OFFSET | Int | 0 | The earliest offset. |
TRACE_ON | Boolean | true | Indicates whether a message trace exists. Valid values:
|
MAX_OFFSET | Int | 8 | The latest offset. |
MSG_REGION | String | cn-hangzhou | The region from which the message is sent. |
KEYS | String | systemProperties.KEYS | The keys that are used to filter the message. |
CONSUME_START_TIME | Long | 1628577790396 | The start time of message consumption. Unit: milliseconds. |
UNIQ_KEY | String | AC14C305069E1B28CDFA3181CDA2**** | The unique key of the message. |
TAGS | String | systemProperties.TAGS | The tags that are used to filter the message. |
INSTANCE_ID | String | MQ_INST_123456789098****_BXhFHryi | The ID of the ApsaraMQ for RocketMQ instance. |
userProperties | Map | None | The user properties. |
body | String | TEST | The message body. |
ApsaraMQ for RabbitMQ triggers
Sample code of event:
[
{
"id":"bj694332-4cj1-389e-9d8c-b137h30b****",
"source":"RabbitMQ-Function-rabbitmq-trigger",
"specversion":"1.0",
"type":"amqp:Queue:SendMessage",
"datacontenttype":"application/json;charset=utf-8",
"subject":"acs:amqp:cn-hangzhou:164901546557****:/instances/amqp-cn-tl32e756****/vhosts/eb-connect/queues/housekeeping",
"time":"2021-08-12T06:56:40.709Z",
"aliyunaccountid":"164901546557****",
"aliyunpublishtime":"2021-10-15T08:58:55.140Z",
"aliyunoriginalaccountid":"164901546557****",
"aliyuneventbusname":"RabbitMQ-Function-rabbitmq-trigger",
"aliyunregionid":"cn-chengdu",
"aliyunpublishaddr":"42.120.XX.XX",
"data":{
"envelope":{
"deliveryTag":98,
"exchange":"",
"redeliver":false,
"routingKey":"housekeeping"
},
"body":{
"Hello":"RabbitMQ"
},
"props":{
"contentEncoding":"UTF-8",
"messageId":"f7622d51-e198-41de-a072-77c1ead7****"
}
}
},
{
"id":"bj694332-4cj1-389e-9d8c-b137h30b****",
"source":"RabbitMQ-Function-rabbitmq-trigger",
"specversion":"1.0",
"type":"amqp:Queue:SendMessage",
"datacontenttype":"application/json;charset=utf-8",
"subject":"acs:amqp:cn-hangzhou:164901546557****:/instances/amqp-cn-tl32e756****/vhosts/eb-connect/queues/housekeeping",
"time":"2021-08-12T06:56:40.709Z",
"aliyunaccountid":"164901546557****",
"aliyunpublishtime":"2021-10-15T08:58:55.140Z",
"aliyunoriginalaccountid":"164901546557****",
"aliyuneventbusname":"RabbitMQ-Function-rabbitmq-trigger",
"aliyunregionid":"cn-chengdu",
"aliyunpublishaddr":"42.120.XX.XX",
"data":{
"envelope":{
"deliveryTag":98,
"exchange":"",
"redeliver":false,
"routingKey":"housekeeping"
},
"body":{
"Hello":"RabbitMQ"
},
"props":{
"contentEncoding":"UTF-8",
"messageId":"f7622d51-e198-41de-a072-77c1ead7****"
}
}
}
]The following table describes the parameters contained in data. For information about parameters that are defined in the CloudEvents specification, see Overview.
Parameter | Type | Example | Description |
body | Map | The message body. | |
Hello | String | EventBridge | The user data. |
props | Map | The message attributes. | |
contentEncoding | String | utf-8 | The format in which the message body is encoded. |
messageId | String | f7622d51-e198-41de-a072-77c1ead7**** | The message ID. The ID of each message is unique. |
envelope | Map | The information about the message envelope. | |
deliveryTag | Int | 98 | The message tag. |
exchange | String | None | The name of the exchange that sends the message. |
redeliver | Boolean | false | Specifies whether the message can be resent. Valid values:
|
routingKey | String | housekeeping | The routing rule of the message. |
ApsaraMQ for Kafka triggers
The following sample code provides an example of event:
[
{
"specversion":"1.0",
"id":"8e215af8-ca18-4249-8645-f96c1026****",
"source":"acs:alikafka",
"type":"alikafka:Topic:Message",
"subject":"acs:alikafka_pre-cn-i7m2t7t1****:topic:mytopic",
"datacontenttype":"application/json; charset=utf-8",
"time":"2022-06-23T02:49:51.589Z",
"aliyunaccountid":"164901546557****",
"data":{
"topic":"****",
"partition":7,
"offset":25,
"timestamp":1655952591589,
"headers":{
"headers":[
],
"isReadOnly":false
},
"key":"keytest",
"value":"hello kafka msg"
}
},
{
"specversion":"1.0",
"id":"8e215af8-ca18-4249-8645-f96c1026****",
"source":"acs:alikafka",
"type":"alikafka:Topic:Message",
"subject":"acs:alikafka_pre-cn-i7m2t7t1****:topic:mytopic",
"datacontenttype":"application/json; charset=utf-8",
"time":"2022-06-23T02:49:51.589Z",
"aliyunaccountid":"164901546557****",
"data":{
"topic":"****",
"partition":7,
"offset":25,
"timestamp":1655952591589,
"headers":{
"headers":[
],
"isReadOnly":false
},
"key":"keytest",
"value":"hello kafka msg"
}
}
]For information about the parameters defined in the CloudEvents specification, see Overview.
The following table describes the parameters contained in data.
Parameter | Type | Example | Details |
topic | String | TopicName | The topic name. |
partition | Int | 1 | The information about partitions on the ApsaraMQ for Kafka instance. |
offset | Int | 0 | The message offset of the ApsaraMQ for Kafka instance. |
timestamp | String | 1655952591589 | The timestamp that indicates when message consumption started. |
DTS triggers
The following sample code provides an example on the format of the event content:
[
{
"data": {
"id": 321****,
"topicPartition": {
"hash": 0,
"partition": 0,
"topic": "cn_hangzhou_rm_1234****_test_version2"
},
"offset": 3218099,
"sourceTimestamp": 1654847757,
"operationType": "UPDATE",
"schema": {
"recordFields": [
{
"fieldName": "id",
"rawDataTypeNum": 8,
"isPrimaryKey": true,
"isUniqueKey": false,
"fieldPosition": 0
},
{
"fieldName": "topic",
"rawDataTypeNum": 253,
"isPrimaryKey": false,
"isUniqueKey": false,
"fieldPosition": 1
}
],
"nameIndex": {
"id": {
"fieldName": "id",
"rawDataTypeNum": 8,
"isPrimaryKey": true,
"isUniqueKey": false,
"fieldPosition": 0
},
"topic": {
"fieldName": "topic",
"rawDataTypeNum": 253,
"isPrimaryKey": false,
"isUniqueKey": false,
"fieldPosition": 1
}
},
"schemaId": "(hangzhou-test-db,hangzhou-test-db,message_info)",
"databaseName": "hangzhou--test-db",
"tableName": "message_info",
"primaryIndexInfo": {
"indexType": "PrimaryKey",
"indexFields": [
{
"fieldName": "id",
"rawDataTypeNum": 8,
"isPrimaryKey": true,
"isUniqueKey": false,
"fieldPosition": 0
}
],
"cardinality": 0,
"nullable": true,
"isFirstUniqueIndex": false
},
"uniqueIndexInfo": [],
"foreignIndexInfo": [],
"normalIndexInfo": [],
"databaseInfo": {
"databaseType": "MySQL",
"version": "5.7.35-log"
},
"totalRows": 0
},
"beforeImage": {
"recordSchema": {
"recordFields": [
{
"fieldName": "id",
"rawDataTypeNum": 8,
"isPrimaryKey": true,
"isUniqueKey": false,
"fieldPosition": 0
},
{
"fieldName": "topic",
"rawDataTypeNum": 253,
"isPrimaryKey": false,
"isUniqueKey": false,
"fieldPosition": 1
}
],
"nameIndex": {
"id": {
"fieldName": "id",
"rawDataTypeNum": 8,
"isPrimaryKey": true,
"isUniqueKey": false,
"fieldPosition": 0
},
"topic": {
"fieldName": "topic",
"rawDataTypeNum": 253,
"isPrimaryKey": false,
"isUniqueKey": false,
"fieldPosition": 1
}
},
"schemaId": "(hangzhou-test-db,hangzhou-test-db,message_info)",
"databaseName": "hangzhou-test-db",
"tableName": "message_info",
"primaryIndexInfo": {
"indexType": "PrimaryKey",
"indexFields": [
{
"fieldName": "id",
"rawDataTypeNum": 8,
"isPrimaryKey": true,
"isUniqueKey": false,
"fieldPosition": 0
}
],
"cardinality": 0,
"nullable": true,
"isFirstUniqueIndex": false
},
"uniqueIndexInfo": [],
"foreignIndexInfo": [],
"normalIndexInfo": [],
"databaseInfo": {
"databaseType": "MySQL",
"version": "5.7.35-log"
},
"totalRows": 0
},
"values": [
{
"data": 115
},
{
"data": {
"hb": [
104,
101,
108,
108,
111
],
"offset": 0,
"isReadOnly": false,
"bigEndian": true,
"nativeByteOrder": false,
"mark": -1,
"position": 0,
"limit": 9,
"capacity": 9,
"address": 0
},
"charset": "utf8mb4"
}
],
"size": 45
},
"afterImage": {
"recordSchema": {
"recordFields": [
{
"fieldName": "id",
"rawDataTypeNum": 8,
"isPrimaryKey": true,
"isUniqueKey": false,
"fieldPosition": 0
},
{
"fieldName": "topic",
"rawDataTypeNum": 253,
"isPrimaryKey": false,
"isUniqueKey": false,
"fieldPosition": 1
}
],
"nameIndex": {
"id": {
"fieldName": "id",
"rawDataTypeNum": 8,
"isPrimaryKey": true,
"isUniqueKey": false,
"fieldPosition": 0
},
"topic": {
"fieldName": "topic",
"rawDataTypeNum": 253,
"isPrimaryKey": false,
"isUniqueKey": false,
"fieldPosition": 1
}
},
"schemaId": "(hangzhou-test-db,hangzhou-test-db,message_info)",
"databaseName": "hangzhou-test-db",
"tableName": "message_info",
"primaryIndexInfo": {
"indexType": "PrimaryKey",
"indexFields": [
{
"fieldName": "id",
"rawDataTypeNum": 8,
"isPrimaryKey": true,
"isUniqueKey": false,
"fieldPosition": 0
}
],
"cardinality": 0,
"nullable": true,
"isFirstUniqueIndex": false
},
"uniqueIndexInfo": [],
"foreignIndexInfo": [],
"normalIndexInfo": [],
"databaseInfo": {
"databaseType": "MySQL",
"version": "5.7.35-log"
},
"totalRows": 0
},
"values": [
{
"data": 115
},
{
"data": {
"hb": [
98,
121,
101
],
"offset": 0,
"isReadOnly": false,
"bigEndian": true,
"nativeByteOrder": false,
"mark": -1,
"position": 0,
"limit": 11,
"capacity": 11,
"address": 0
},
"charset": "utf8mb4"
}
],
"size": 47
}
},
"id": "12f701a43741d404fa9a7be89d9acae0-321****",
"source": "DTSstreamDemo",
"specversion": "1.0",
"type": "dts:ConsumeMessage",
"datacontenttype": "application/json; charset=utf-8",
"time": "2022-06-10T07:55:57Z",
"subject": "acs:dts:cn-hangzhou:12345****:kk123abc60g782/dtsabcdet1ro"
}
]For information about the parameters defined in the CloudEvents specification, see Overview.
The following table describes the parameters contained in the data field.
Parameter | Type | Description |
id | String | The ID of the DTS data entry. |
topicPartition | Array | The partition information about the topic to which the event is pushed. |
hash | String | The underlying storage parameter of DTS. |
partition | String | The partition. |
topic | String | The topic name. |
offset | Int | The offset of the DTS data entry. |
sourceTimestamp | Int | The timestamp that indicates when the DTS data entry was generated. |
operationType | String | The type of operation involved in the DTS data entry. |
schema | Array | The schema information about the database. |
recordFields | Array | The details of fields. |
fieldName | String | The field name. |
rawDataTypeNum | Int | The mapped value of the field type. The value of this parameter corresponds to the value of the dataTypeNumber field in the deserialized incremental data from the change tracking instance. For more information, see Use a Kafka client to consume tracked data. |
isPrimaryKey | Boolean | Indicates whether the field is a primary key field. |
isUniqueKey | Boolean | Indicates whether the field has a unique key. |
fieldPosition | String | The field position. |
nameIndex | Array | The indexing information about the fields based on field names. |
schemaId | String | The ID of the database schema. |
databaseName | String | The database name. |
tableName | String | The table name. |
primaryIndexInfo | String | The primary key indexes. |
indexType | String | The index type. |
indexFields | Array | The fields on which the indexes are created. |
cardinality | String | The cardinality of the primary keys. |
nullable | Boolean | Indicates whether the primary keys can be null. |
isFirstUniqueIndex | Boolean | Indicates whether the index is the first unique index. |
uniqueIndexInfo | String | The unique indexes. |
foreignIndexInfo | String | The indexes for foreign keys. |
normalIndexInfo | String | The regular indexes. |
databaseInfo | Array | The information about the database. |
databaseType | String | The database engine. |
version | String | The database engine version. |
totalRows | Int | The total number of rows in the table. |
beforeImage | String | The image that records field values before the operation is performed. |
values | String | The field values recorded. |
size | Int | The size of the fields recorded. |
afterImage | String | The image that records field values after the operation is performed. |
ApsaraMQ for MQTT triggers
[
{
"props": {
"firstTopic": "testTopic",
"secondTopic": "/testMq4****",
"clientId": "consumerGroupID@@@xxx"
},
"body": "hello mq4Iot pub sub msg"
}
]The following table describes the parameters of the event.
Parameter | Type | Example | Description |
props | Map | The attributes of the message. | |
firstTopic | String | testTopic | The parent topic that is used to send and receive messages. |
secondTopic | String | /testMq4**** | The child topic. |
clientId | String | consumerGroupID@@@xx | The client ID. |
body | String | hello mq4Iot pub sub msg | The content of the message. |
Self-managed Apache RocketMQ triggers
[
{
"msgId": "7F0000010BDD2A84AEE70DA49B57****",
"topic": "testTopic",
"systemProperties": {
"UNIQ_KEY": "7F0000010BDD2A84AEE70DA49B57****",
"CLUSTER": "DefaultCluster",
"MIN_OFFSET": "0",
"TAGS": "TagA",
"MAX_OFFSET": "128"
},
"userProperties": {},
"body": "Hello RocketMQ"
}
]The following table describes the parameters of the event.
Parameter | Type | Example | Description |
msgId | String | 7F0000010BDD2A84AEE70DA49B57**** | The ID of the Apache RocketMQ message. |
topic | String | testTopic | The name of the topic in the Apache RocketMQ cluster. |
systemProperties | Map | The system properties. | |
UNIQ_KEY | String | 7F0000010BDD2A84AEE70DA49B57**** | The unique key of the message. |
CLUSTER | String | DefaultCluster | The name of the Apache RocketMQ cluster. |
MIN_OFFSET | Int | 0 | The minimum offset. |
MAX_OFFSET | Int | 128 | The maximum offset. |
TAGS | String | TagA | The tags that are used to filter messages. |
userProperties | Map | N/A | The user properties. |
body | String | Hello RocketMQ | The content of the message. |