All Products
Search
Document Center

Simple Message Queue (formerly MNS):OSS event notifications

Last Updated:Jun 04, 2026

By creating an event notification rule, you can use Simple Message Queue (SMQ) to push event messages from your Object Storage Service (OSS) resources to a specified endpoint. This topic covers event types, message format, and steps to create notification rules.

Background

After you create an event notification rule, Simple Message Queue (SMQ) pushes event messages from specified OSS resources to an endpoint, as shown below.

image

When an OSS operation triggers a matching event notification rule, a header is added to the response. This header describes the notification result without affecting the original API response. If no rule matches, no header is added. If a rule matches, the header is added regardless of whether the message was sent successfully. The format is:

x-oss-process-status: 'ewogICAgImNvZGUiOiAiU3VjY2VzcyIsCiAgICAibWVzc2FnZSI6ICJOb3RpZmljYXRpb25TdWNjZWVkIiwKICAgICJ0eXBlIjogIkV2ZW50Tm90aWZpY2F****'
  • Key: x-oss-process-status

  • Value: A Base64-encoded string. The following example shows the decoded JSON object:

    {
        "code":"Success",  // The result of the event notification attempt. Returns Success or Fail. Success indicates that OSS sent the message to the topic, but does not guarantee that the topic pushed the message to the endpoint.
        "message":"NotificationSucceed",   // A detailed description of the operation. If it fails, this field provides the reason for the failure.
        "type":"EventNotification",   // The operation type. For event notifications, this is always EventNotification.
        "version":"1.0"
    }

Push types describes available message delivery methods.

Use cases

  • Monitor resource activity. Create rules to receive notifications when other users perform operations on your buckets.

  • Analyze data and trends. Track operational frequency over time, or import notification messages into services such as E-MapReduce (EMR) for further analysis.

  • Monitor operational metrics. Track metrics such as queries per second (QPS) for specific operations on your resources.

Event types

Group

Type

Description

ObjectCreated (Create object)

ObjectCreated:PutObject

Uploads an object. PutObject.

ObjectCreated:PostObject

Uploads an object via form-based POST. PostObject.

ObjectCreated:CopyObject

Copies an object. CopyObject.

ObjectCreated:AppendObject

Appends data to upload an object. AppendObject.

ObjectCreated:InitiateMultipartUpload

Initiates a multipart upload. InitiateMultipartUpload.

ObjectCreated:UploadPart

Uploads a part in a multipart upload. UploadPart.

ObjectCreated:UploadPartCopy

Copies a part in a multipart upload. UploadPartCopy.

ObjectCreated:CompleteMultipartUpload

Completes a multipart upload. CompleteMultipartUpload.

ObjectCreated:PutSymlink

Creates a symbolic link for an object. PutSymlink.

ObjectCreated:Mirror

The object is created by mirroring.

Note

By default, OSS mirroring triggers ObjectCreated:PutObject. To use ObjectCreated:Mirror instead, submit a ticket.

ObjectCreated:*

Any event prefixed with ObjectCreated:.

Note

This wildcard covers all current and future event types under ObjectCreated.

ObjectDownloaded (Download object)

ObjectDownloaded:GetObject

An object is downloaded.

ObjectModified (Modify object)

ObjectModified:UpdateObjectMeta

Object metadata is modified via UpdateObjectMeta.

ObjectModified:ChangeStorageClass

The storage class of an object is changed by a lifecycle rule.

ObjectModified:*

Any event prefixed with ObjectModified:.

Note

This wildcard covers all current and future event types under ObjectModified.

ObjectRemoved (Delete object)

ObjectRemoved:DeleteObject

Deletes a single object. DeleteObject.

ObjectRemoved:DeleteObjects

Deletes multiple objects. DeleteMultipleObjects.

ObjectRemoved:AbortMultipartUpload

Aborts a multipart upload and deletes its parts. AbortMultipartUpload.

ObjectRemoved:*

Any event prefixed with ObjectRemoved:.

Note

This wildcard covers all current and future event types under ObjectRemoved.

ObjectReplication (Replicate object)

ObjectReplication:ObjectCreated

A write operation occurs as part of a data replication process.

ObjectReplication:ObjectRemoved

A delete operation occurs as part of a data replication process.

ObjectReplication:ObjectModified

An overwrite operation occurs as part of a data replication process.

ObjectReplication:*

Any event prefixed with ObjectReplication:.

Note

This wildcard covers all current and future event types under ObjectReplication.

ObjectRestore (Restore object)

ObjectRestore:FinishRestore

An object is restored from archive storage. Applies only to Cold Archive and Deep Cold Archive objects.

Message format

OSS event notification messages are Base64-encoded JSON objects. The following example shows a decoded message payload.

{
    "events":[
        {
            "eventName":"ObjectDownloaded:GetObject",
            "eventSource":"acs:oss",
            "eventTime":"2016-07-01T11:17:30.000Z",
            "eventVersion":"1.0",
            "oss":{
                "bucket":{
                    "arn":"acs:oss:cn-shenzhen:123456789098****:event-notification-test-shenzhen",
                    "name":"event-notification-test-shenzhen",
                    "ownerIdentity":"123456789098****"
                },
                "object":{
                    "deltaSize":0,
                    "eTag":"0CC175B9C0F1B6A831C399E26977****",
                    "key":"test",
                    "readFrom":0,
                    "readTo":1,
                    "size":1
                },
                "ossSchemaVersion":"1.0",
                "ruleId":"GetObjectRule"
            },
            "region":"cn-shenzhen",
            "requestParameters":{
                "sourceIPAddress":"140.205.XX.XX"
            },
            "responseElements":{
                "requestId":"5776514AF09A9E654242****"
            },
            "userIdentity":{
                "principalId":"123456789098****"
            },
            "xVars":{
                "x:callback-var1":"value1",
                "x:callback-var2":"value2"
            }
        }
    ]
}

The message payload contains the following parameters.

Parameter

Description

eventName

The type of event.

eventSource

The source of the event.

eventTime

The time when the event occurred, in UTC.

eventVersion

The version of the event schema.

oss

Contains details about the OSS event.

bucket

Contains details about the bucket.

arn

The Alibaba Cloud Resource Name (ARN) of the bucket.

name

The name of the bucket.

ownerIdentity

The ID of the user who owns the bucket.

object

Contains details about the object.

deltaSize

The change in the object size, in bytes.

eTag

The ETag of the object. For PutObject requests, this is the MD5 hash. For other operations, this is a unique identifier (not an MD5 hash). Use the ETag to verify object content integrity.

key

The name of the object.

readFrom

The starting byte position for a read operation.

readTo

The ending byte position for a read operation.

size

The total size of the object in bytes.

ossSchemaVersion

The version of the OSS-specific schema.

ruleId

The ID of the rule that triggered the event.

region

The region where the bucket is located.

requestParameters

Parameters from the original request.

sourceIPAddress

The source IP address of the request.

responseElements

Elements from the response.

requestId

The unique ID for the request.

userIdentity

Information about the user who made the request.

principalId

The User ID (UID) of the requester.

xVars

Custom parameters from an OSS callback configuration.

Usage notes

  • Event notification rules take about 10 minutes to take effect after creation.

  • A topic is created for each new rule and may incur charges per the Billing guide.

  • Event notification rules can be created and deleted but not modified.

(Optional) Step 1: Create a queue

Create a queue if you plan to use one as the notification destination. You can also add subscriptions after creating the event rule.

  1. Log on to the SMQ console.

  2. In the left-side navigation pane, choose Queue Model > Queues.

  3. In the top navigation bar, select a region.

  4. On the Queues page, click Create Queue.

  5. In the Create Queue panel, configure the following parameters and click OK:

    • Name: the name of the queue.

    • Maximum Message Length: the maximum length of the message that is sent to the queue.

    • Long Polling Period: the maximum duration for which long polling requests are held after the ReceiveMessage operation is called.

    • Visibility Timeout Period: the duration for which a message stays in the Inactive state after the message is received from the queue.

    • Message Retention Period: the maximum duration for which a message exists in the queue. After the specified retention period, the message is deleted regardless of whether the message is received.

    • Message Delay Period: the period after which all messages sent to the queue are consumed.

    • Enable Logging Feature: specifies whether to enable the logging feature.

    After the queue is created, it is displayed on the Queues page.

(Optional) Step 2: Create a bucket

If the desired bucket already exists, you can skip this step.

  1. Log on to the OSS console.

  2. In the left-side navigation pane, click Buckets.

  3. On the Buckets page, click Create bucket.

  4. In the Create bucket panel, configure the bucket parameters, and then click OK.

    • Bucket name: Enter event-notification-test.

    • Region: Select the same region as your queue.

    • Block public access: Select Off.

    • ACL: Select Public Read/Write.

      Note

      Keep the default values for other settings.

Step 3: Create a custom rule

When you create a rule, Simple Message Queue (SMQ) automatically creates a topic and subscription for the specified endpoint. You can manage these in the SMQ console.

  1. Log on to the SMQ console.

  2. In the left-side navigation pane, click Event Notifications.

  3. In the top navigation bar, select a region.

  4. On the Event Notifications page, click the OSS tab, and then click Create Rule.

  5. In the Create rule - OSS panel, configure the following settings, and then click OK.

    • Instance Name: Enter a name for the rule.

    • Event Type: Select one or more event types.

    • Match rule: Configure the match rule.

      Note

      A match rule can be a full name, a prefix, a suffix, or a combination of a prefix and a suffix. Different rules cannot have overlapping resource definitions. An OSS resource is specified in the format bucket/object. For example, in the resource movie/hello.avi, movie is the bucket and hello.avi is the object.

      • Full Name: movie/hello.avi.

      • Prefix:

        • movie/hello: Matches all objects in the movie bucket that have the prefix hello.

        • movie/: Matches all objects in the movie bucket.

        • mov: Matches all objects in any bucket whose name has the prefix mov.

      • Suffix: .avi: Matches all objects in any bucket that have the suffix .avi.

      • Prefix and Suffix: Prefix movie/ and suffix .avi: Matches all objects in the movie bucket that have the suffix .avi.

    • Destination: Select Queue and enter the name of the queue that you created in Step 1.

Step 4: Upload an object

  1. Log on to the OSS console.

  2. In the left-side navigation pane, click Buckets.

  3. On the Buckets page, click the name of the target bucket.

  4. Choose Object management > Object list, and then click Upload object.

  5. In the Upload object panel, specify the upload directory and object ACL, and then click Upload object. Upload objects by using the OSS console.

    The Status column displays "Uploaded".

Step 5: Receive messages

  1. Log on to the SMQ console.

  2. In the left-side navigation pane, choose Queue Model > Queues.

  3. In the top navigation bar, select a region.

  4. On the Queues page, find the target queue, and in the Action column, choose More > Send and receive messages.

  5. On the Send and receive messages page, in the Receive messages section, click Receive message.

    The message list for the queue is displayed in the Receive messages section.

  6. In the message list, find the target message, and then click Details in the Actions column to view its content in the Message details dialog box.