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"
}            
ParameterTypeExampleDescription
triggerTimeString2018-02-09T05:49:00ZThe time when the function is triggered.
triggerNameStringtimer-triggerThe name of the time trigger.
payloadStringawesome-fcThe 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****"
            }
        }
    ]
}          
The following table describes the fields in event.
ParameterTypeExampleDescription
eventNameStringObjectCreated:PutObjectThe type of the event.
eventSourceStringacs:ossThe event source. Set the value to acs:oss.
eventTimeString2022-08-13T06:45:43.000ZThe time when the event occurs. The time follows the ISO 8601 standard format.
eventVersionString1.0The version of the event protocol.
ossMapThe content of the OSS event.
bucketMapDetails of the OSS bucket.
nameStringtestbucketThe name of the bucket.
arnStringacs:oss:cn-shanghai:123456789:bucketnameThe Alibaba Cloud Resource Name (ARN) of the bucket.
ownerIdentityString164901546557****The ID of the user that created the bucket.
objectMapDetails of the OSS object.
sizeInt122539The size of the OSS object. Unit: byte.
deltaSizeInt122539The variation of the size of the OSS object. Unit: byte.
  • If an object is added, the value of this parameter indicates the size of the object.
  • If a new object overwrites the object that has the identical name, the value of this parameter specifies the size difference between the new object and the original object.
eTagString688A7BF4F233DC9C88A80BF985AB****The tag of the object.
keyStringimage/a.jpgThe name of the object.
ossSchemaVersionString1.0The version of the OSS schema.
ruleIdString9adac8e253828f4f7c0466d941fa3db81161****The ID of the rule that matches the event.
regionStringcn-shanghaiThe region in which the bucket resides.
requestParametersMapThe request parameters.
sourceIPAddressString140.205.XX.XXThe IP address from which the request is sent.
responseElementsMapThe response elements.
requestIdString58F9FF2D3DF792092E12044CThe ID of the request.
userIdentityMapThe property of the user.
principalIdString164901546557****The ID of the Alibaba Cloud account that initiated the request.

Log Service trigger

The event parameter is the input parameter of Function Compute. The following code shows the format of the event parameter:
{
    "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
}                       
FieldDescriptionExample
parameterThe value of Invocation Parameters. None
sourceThe log block information that you want the function to read from Log Service.
  • endpoint: the endpoint of the Alibaba Cloud region in which the Log Service project is located.
  • projectName: the name of the Log Service project.
  • logstoreName: the name of the Logstore.
  • shardId: the ID of a specified shard in the Logstore.
  • beginCursor: the offset where data consumption starts.
  • endCursor: the offset where data consumption ends.
{
    "endpoint":"http://cn-shanghai-intranet.log.aliyuncs.com",
    "projectName":"log-com",
    "logstoreName":"log-en",
    "shardId":0,
    "beginCursor":"MTUyOTQ4MDIwOTY1NTk3ODQ2Mw==",
    "endCursor":"MTUyOTQ4MDIwOTY1NTk3ODQ2NA=="
}
jobNameThe name of an extract, transform, and load (ETL) job in Log Service. Log Service triggers must correspond to ETL jobs in Log Service. 1f7043ced683de1a4e3d8d70b5a412843d81****
taskIdFor an ETL job, taskId is the identifier for a deterministic function invocation. c2691505-38da-4d1b-998a-f1d4bb8c****
cursorTimeThe 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
                }
            ]
        }
    ]
}
The following table describes the fields in the event parameter.
FieldDescription
VersionThe version of the payload. Example: Sync-v1. The value is a string.
RecordsThe array that stores the row of incremental data in the data table. This parameter includes the following fields:
  • Type: the type of the operation that is performed on the row. Valid values: PutRow, UpdateRow, and DeleteRow. The value is a string.
  • Info: includes the Timestamp field, which specifies the time when the row was last modified. The value of Timestamp must be in UTC. The value is of type "Int64."
PrimaryKeyThe array that stores the primary key column. This parameter includes the following fields:
  • ColumnName: the name of the primary key column. The value is a string.
  • Value: the content of the primary key column. The value is of type formated_value, which can be Integer, String, or Blob.
ColumnsThe array that stores the attribute columns. This parameter includes the following fields:
  • Type: the type of the operation that is performed on the attribute column. Valid values: Put, DeleteOneVersion, and DeleteAllVersions. The value is a string.
  • ColumnName: the name of the attribute column. The value is a string.
  • Value: the content of the attribute column. The value is of type formatted_value, which can be Integer, Boolean, Double, String, or Blob.
  • Timestamp: the time when the attribute column was last modified. The value of Timestamp must be in UTC. The value is of type "Int64."

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"
}  
Note
  • If the value of isBase64Encoded is true, 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 is false, 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

Sample code on the format of 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"
    }
}
Sample code on the format of 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"
    }
    }
]
The following table describes the parameters in data. For information about the parameters that are defined in the CloudEvents specification, see Overview.
ParameterTypeExampleDescription
requestIdString606EA3074344430D4C81****The ID of the request. The ID of each request is unique.
messageIdStringC6DB60D1574661357FA227277445****The ID of the message. The ID of each message is unique.
messageBodyStringTESTThe content of the message.

Message Queue for Apache RocketMQ trigger

Sample code for the 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"
    }
}
Sample code for the 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"
    }
    }
]
The following table describes the parameters in data. For information about the parameters that are defined in the CloudEvents specification, see Overview.
ParameterTypeExampleDescription
topicStringTopicNameThe name of the topic.
systemPropertiesMapThe system properties.
MIN_OFFSETInt0The earliest offset.
TRACE_ONBooleantrueIndicates whether a message trace exists. Valid values:
  • true: A message trace exists.
  • false: No message trace exists.
MAX_OFFSETInt8The latest offset.
MSG_REGIONStringcn-hangzhouThe region from which the message was sent.
KEYSStringsystemProperties.KEYSThe keys for filtering.
CONSUME_START_TIMELong1628577790396The start time of consumption. Unit: milliseconds.
UNIQ_KEYStringAC14C305069E1B28CDFA3181CDA2****The unique key of the message.
TAGSStringsystemProperties.TAGSThe tags for filtering.
INSTANCE_IDStringMQ_INST_123456789098****_BXhFHryiThe ID of the instance.
userPropertiesMapN/AThe user properties.
bodyStringTESTThe content of the message.

Message Queue for RabbitMQ trigger

Sample code for the 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****"
        }
    }
}
Sample code for the 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****"
        }
    }
    }
]
The following table describes the parameters in data. For information about the parameters that are defined in the CloudEvents specification, see Overview.
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:
  • true: The message can be resent.
  • false: The message cannot be resent.
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.

ParameterTypeExampleDescription
topicStringTopicNameThe name of the topic.
partitionInt1The partition number in the Message Queue for Apache Kafka instance.
offsetInt0The consumer offset of the Message Queue for Apache Kafka instance.
timestampString1655952591589The 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.