Different triggers have different formats of event passed to function interfaces. This topic describes the formats of event for different triggers in Function Compute.
Usage notes
The trigger events of triggers, which is passed in the form of event, must be parsed before you can use it. For the sample code for parsing event, see Example 1: Parse JSON-formatted parameters.
Time trigger
{
"triggerTime":"2018-02-09T05:49:00Z",
"triggerName":"timer-trigger",
"payload":"awesome-fc"
}
Parameter | Type | Example | Description |
---|---|---|---|
triggerTime | String | 2018-02-09T05:49:00Z | The time when the function is triggered. |
triggerName | String | timer-trigger | The name of the time trigger. |
payload | String | awesome-fc | The value of Trigger Message that you entered when you created the trigger. |
OSS trigger
{
"events":[
{
"eventName":"ObjectCreated:PutObject",
"eventSource":"acs:oss",
"eventTime":"2022-08-13T06:45:43.000Z",
"eventVersion":"1.0",
"oss":{
"bucket":{
"arn":"acs:oss:cn-shanghai:123456789:bucketname",
"name":"testbucket",
"ownerIdentity":"164901546557****"
},
"object":{
"deltaSize":122539,
"eTag":"688A7BF4F233DC9C88A80BF985AB****",
"key":"image/a.jpg",
"size":122539
},
"ossSchemaVersion":"1.0",
"ruleId":"9adac8e253828f4f7c0466d941fa3db81161****"
},
"region":"cn-shanghai",
"requestParameters":{
"sourceIPAddress":"140.205.XX.XX"
},
"responseElements":{
"requestId":"58F9FF2D3DF792092E12044C"
},
"userIdentity":{
"principalId":"164901546557****"
}
}
]
}
Parameter | Type | Example | Description |
---|---|---|---|
eventName | String | ObjectCreated:PutObject | The type of the event. |
eventSource | String | acs:oss | The event source. Set the value to acs:oss . |
eventTime | String | 2022-08-13T06:45:43.000Z | The time when the event occurs. The time follows the ISO 8601 standard format. |
eventVersion | String | 1.0 | The version of the event protocol. |
oss | Map | The content of the OSS event. | |
bucket | Map | Details of the OSS bucket. | |
name | String | testbucket | The name of the bucket. |
arn | String | acs:oss:cn-shanghai:123456789:bucketname | The Alibaba Cloud Resource Name (ARN) of the bucket. |
ownerIdentity | String | 164901546557**** | The ID of the user that created the bucket. |
object | Map | Details of the OSS object. | |
size | Int | 122539 | The size of the OSS object. Unit: byte. |
deltaSize | Int | 122539 | The variation of the size of the OSS object. Unit: byte.
|
eTag | String | 688A7BF4F233DC9C88A80BF985AB**** | The tag of the object. |
key | String | image/a.jpg | The name of the object. |
ossSchemaVersion | String | 1.0 | The version of the OSS schema. |
ruleId | String | 9adac8e253828f4f7c0466d941fa3db81161**** | The ID of the rule that matches the event. |
region | String | cn-shanghai | 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 response elements. | |
requestId | String | 58F9FF2D3DF792092E12044C | The ID of the request. |
userIdentity | Map | The property of the user. | |
principalId | String | 164901546557**** | The ID of the Alibaba Cloud account that initiated the request. |
Log Service trigger
{
"parameter": {},
"source": {
"endpoint": "http://cn-shanghai-intranet.log.aliyuncs.com",
"projectName": "log-com",
"logstoreName": "log-en",
"shardId": 0,
"beginCursor": "MTUyOTQ4MDIwOTY1NTk3ODQ2Mw==",
"endCursor": "MTUyOTQ4MDIwOTY1NTk3ODQ2NA=="
},
"jobName": "1f7043ced683de1a4e3d8d70b5a412843d81****",
"taskId": "c2691505-38da-4d1b-998a-f1d4bb8c****",
"cursorTime": 1529486425
}
Field | Description | Example |
---|---|---|
parameter | The value of Invocation Parameters. | None |
source | The log block information that you want the function to read from Log Service.
|
|
jobName | The name of an extract, transform, and load (ETL) job in Log Service. Log Service triggers must correspond to ETL jobs in Log Service. | 1f7043ced683de1a4e3d8d70b5a412843d81**** |
taskId | For an ETL job, taskId is the identifier for a deterministic function invocation. | c2691505-38da-4d1b-998a-f1d4bb8c**** |
cursorTime | The Unix timestamp of the time when the last log arrives at Log Service. Unit: seconds. | 1529486425 |
CDN trigger
The event parameter is an input parameter of Function Compute. The following code shows the format of the event parameter. The key-value pairs in eventParameter vary with the Alibaba Cloud CDN event type.
- Example of the LogFileCreated event
Replace
filePath
with the path of the Alibaba Cloud CDN log 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.Field Type Example Description eventName String LogFileCreated The type of the event. eventSource String cdn The name of the event source. region String cn-hangzhou The region where Alibaba Cloud CDN resides. Default value: cn-hangzhou. 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 user attributes. aliUid String 164901546557**** The ID of the Alibaba Cloud account. resource Map The information about the resource. domain String example.com The domain name. eventParameter Map The parameters of the event. domain String example.com The domain name. 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 CachedObjectsRefreshed, CachedObjectsPushed, and CachedObjectsBlocked 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.Field Type Example Description eventName String CachedObjectsRefreshed The type of the event. eventSource String cdn The name of the event source. region String cn-hangzhou The region where Alibaba Cloud CDN resides. Default value: cn-hangzhou. 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 resource. domain String example.com The domain name. eventParameter Map The parameters of the event. objectPath String /2018/03/16/13/33b430c57e7.mp4 The identifier of the resource. createTime String 1521180769 The start time of the refresh. domain String example.com The domain name. 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 user attributes. aliUid String 164901546557**** The ID of the Alibaba Cloud account. - 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.Field Type Example Description eventName String CdnDomainStarted The type of the event. eventSource String cdn The name of the event source. region String cn-hangzhou The region where Alibaba Cloud CDN resides. Default value: cn-hangzhou. 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 resource. domain String example.com The domain name. eventParameter Map The parameters of the event. domain String example.com The domain name. status String online The status of the domain name. userIdentity Map The user attributes. aliUid String 164901546557**** The ID of the Alibaba Cloud account. - 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.Field Type Example Description eventName String CdnDomainAdded The type of the event. eventSource String cdn The name of the event source. region String cn-hangzhou The region where Alibaba Cloud CDN resides. Default value: cn-hangzhou. 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 resource. domain String example.com The domain name. eventParameter Map The parameters of the event. domain String example.com The domain name. userIdentity Map The user attributes. aliUid String 164901546557**** The ID of the Alibaba Cloud account.
Tablestore trigger
{
"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
}
]
}
]
}
Field | Description |
---|---|
Version | The version of the payload. Example: Sync-v1. The value is a string. |
Records | The array that stores the row of incremental data in the data table. This parameter includes the following fields:
|
PrimaryKey | The array that stores the primary key column. This parameter includes the following fields:
|
Columns | The array that stores the attribute columns. This parameter includes the following fields:
|
MNS topic trigger
- If you select STREAM for Event Format:
The following code shows the format of the event parameter if messages do not contain message attributes:
Note If messages do not contain message attributes, the content of the event parameter is a string in JSON format.# The message body. 'hello topic'
The following code shows the format of the event parameter if messages contain message attributes:
Note The content of the event parameter contains the key-value pairs that are related to message attributes. For more information, see PublishMessage.{ "body": "hello topic", "attrs": { "Extend": "{\\"key\\":\\"value\\"}" } }
- If you select JSON for Event Format:
The following code shows the format of the event parameter 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 code shows the format of the event parameter if messages contain message attributes:
Note The content of the event parameter 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****" }
API Gateway trigger
{
"path":"api request path",
"httpMethod":"request method name",
"headers":{all headers,including system headers},
"queryParameters":{query parameters},
"pathParameters":{path parameters},
"body":"string of request payload",
"isBase64Encoded":"true|false, indicate if the body is Base64-encode"
}
- If the value of
isBase64Encoded
istrue
, the body content that API Gateway sends to Function Compute is Base64-encoded. Function Compute decodes the body content from Base64 format before the content is processed. - If the value of
isBase64Encoded
isfalse
, API Gateway does not perform Base64 encoding on the body content. Function Compute can directly obtain the body content.
DataHub trigger
{
"eventSource": "acs:datahub",
"eventName": "acs:datahub:putRecord",
"eventSourceARN": "/projects/test_project_name/topics/test_topic_name",
"region": "cn-hangzhou",
"records": [
{
"eventId": "0:12345",
"systemTime": 1463000123000,
"data": "[\"col1's value\",\"col2's value\"]"
},
{
"eventId": "0:12346",
"systemTime": 1463000156000,
"data": "[\"col1's value\",\"col2's value\"]"
}
]
}
For more information, see Data structure of events.
MNS queue trigger
event
in the event model: {
"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":"1649015465574023",
"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"
}
}
event
in the event stream model: [
{
"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":"1649015465574023",
"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":"1649015465574023",
"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"
}
}
]
Parameter | Type | Example | Description |
---|---|---|---|
requestId | String | 606EA3074344430D4C81**** | The ID of the request. The ID of each request is unique. |
messageId | String | C6DB60D1574661357FA227277445**** | The ID of the message. The ID of each message is unique. |
messageBody | String | TEST | The content of the message. |
Message Queue for Apache RocketMQ trigger
event
of the event model: {
"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"
}
}
event
of the event stream model: [
{
"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"
}
}
]
Parameter | Type | Example | Description |
---|---|---|---|
topic | String | TopicName | The name of the topic. |
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 was sent. |
KEYS | String | systemProperties.KEYS | The keys for filtering. |
CONSUME_START_TIME | Long | 1628577790396 | The start time of consumption. Unit: milliseconds. |
UNIQ_KEY | String | AC14C305069E1B28CDFA3181CDA2**** | The unique key of the message. |
TAGS | String | systemProperties.TAGS | The tags for filtering. |
INSTANCE_ID | String | MQ_INST_123456789098****_BXhFHryi | The ID of the instance. |
userProperties | Map | N/A | The user properties. |
body | String | TEST | The content of the message. |
Message Queue for RabbitMQ trigger
event
of the event model: {
"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****"
}
}
}
event
of the event stream model: [
{
"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****"
}
}
}
]
Parameter | Type | Example | Description |
---|---|---|---|
body | Map | The content of the message. | |
Hello | String | EventBridge | The user data. |
props | Map | The properties of the message. | |
contentEncoding | String | utf-8 | The format in which the content of the message is encoded. |
messageId | String | f7622d51-e198-41de-a072-77c1ead7**** | The ID of the message. The ID of each message is unique. |
envelope | Map | The envelope information about the message. | |
deliveryTag | Int | 98 | The tag of the message. |
exchange | String | N/A | The name of the exchange that sent the message. |
redeliver | Boolean | false | Indicates whether the message can be resent. Valid values:
|
routingKey | String | housekeeping | The routing rule of the message. |
Message Queue for Apache Kafka trigger
[
{
"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"
}
}
]
The following table describes the parameters contained in data.
Parameter | Type | Example | Description |
---|---|---|---|
topic | String | TopicName | The name of the topic. |
partition | Int | 1 | The partition number in the Message Queue for Apache Kafka instance. |
offset | Int | 0 | The consumer offset of the Message Queue for Apache Kafka instance. |
timestamp | String | 1655952591589 | The timestamp when the consumption started. |
HTTP trigger
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 that invokes a function with HTTP requests.