You need to enable JavaScript to run this app.
Torch Object Storage

Torch Object Storage

Copy page
Download PDF
Event notification
Delivering event notifications to Message Queue for Kafka
Copy page
Download PDF
Delivering event notifications to Message Queue for Kafka
To monitor changes to your TOS bucket resources in real time, you can configure event notification rules. These rules allow you to receive alerts when specific events occur. TOS supports routing these notifications directly to Message Queue for Kafka. This topic describes the prerequisites and steps for configuring an event notification rule to deliver messages to Message Queue for Kafka.​
Background information​
Message Queue for Kafka is a distributed messaging middleware service that is built based on Apache Kafka. TOS supports pushing event notifications directly to Message Queue for Kafka. If you have configured consumers in Message Queue for Kafka, it will deliver received messages to them. When the consumers receive the messages, they execute the relevant operations based on the predefined business logic.​
Prerequisites​
  • You have created a Message Queue for Kafka instance. For instructions, see Create instance.​
  • You have created a Message Queue for Kafka topic. For instructions, see Create topic.​
  • You have created a SASL user. You must set the Password type to PLAIN and enable the ALL Permitted option to grant the user write access to the topic. For instructions, see Create SASL user.​
Notes​
  • A single bucket can have a maximum of 30 event notification rules.​
  • An object cannot match multiple rules that include the same event type. This means that, within the same bucket, event types and prefixes/suffixes across different rules cannot overlap.​
  • The total JSON description size of all event notification rules in a bucket cannot exceed 20 KB.​
Creating an event notification rule​
  1. Log in to the TOS console.​
  1. In the left navigation pane, click Buckets. In the Buckets list, click the bucket you want to manage.​
  1. In the left navigation pane, select Basic configurations > Event notification.​
  1. On the Event notification page, click Create rule.​
  1. On the Create event notification page, set the following parameters:​
  • ​
    Parameter​
    ​
    Description​
    Basic configurations​
    Event name​
    Specify the name of the event notification rule. Naming rules:​
    • Event names must be unique within the bucket.​
    • Length must not exceed 255 characters.​
    ​
    Prefix​
    Enter the prefix of the object(s) to be matched.​
    For example, if the prefix is set to test/, then objects in the test directory will be matched.​
    ​
    Suffix​
    Enter the suffix of the object(s) to be matched.​
    For example, if the suffix is set to .png, then all objects in PNG format will be matched.​
    tip​
    If neither a prefix nor a suffix is set, all objects in the bucket will be matched.​
    Event type​
    Events​
    Select the event(s) to be notified. For a list of types supported by TOS, see Supported event types.​
    warning​
    If the same event type is selected in different rules, the object-matching scopes for this event type must not overlap. This means that a single object cannot trigger multiple rules containing the same event type.​
    For example, if Rule A is created to send a notification for PutObject events on objects with the suffix png, Rule B cannot be configured to trigger for PutObject events on objects with the same suffix png. If there is an overlap, the creation of the rule will fail.​
    Data target​
    Target type​
    Select Kafka.To select multiple instances, click Add row. Up to five instances can be set.​
    ​
    Role​
    Click Click to Authorize, and TOS will automatically create the role TOSNotiKafkaRole to grant TOS access to Message Queue for Kafka.​
    ​
    Instance ID​
    Select the desired Message Queue for Kafka instance(s).​
    tip​
    If no instance is available, you can create one through the Message Queue for Kafka console. For instructions, see Create instance.​
    ​
    Topic​
    Select the desired Message Queue for Kafka topic(s).​
    ​
    User name​
    Select the applicable Message Queue for Kafka SASL user(s).​
    ​
  1. Once you have finished configuring, click Confirm.​
tip​
The event notification rule takes effect five minutes after creation.​
Viewing event notification messages​
You can view event notification messages in the Message Queue for Kafka console. Follow these steps:​
  1. In the top menu bar, select the region of the instance that is associated with your event notification rule.​
  1. In the Instances list, click the instance name.​
  1. On the Instance details page, click the Message query tab.​
  1. Select Query by time and the desired Topic. Set Partition to All and specify the query time range. Then, click Query.​
  • The page displays a list of messages that match the filter criteria. This list includes the following information: topic name, partition, offsets, key, value, value message size, and storage time. The Value column shows the specific content of event notifications. To learn more about event notification parameters, see Event notification structure.​
​
​
Last updated: 2025.11.27 16:02:51