充当事件网格源的 Azure Cache for RedisAzure Cache for Redis as an Event Grid source

本文提供 Azure Cache for Redis 事件的属性和架构。This article provides the properties and schema for Azure Cache for Redis events. 有关事件架构的简介,请参阅 Azure 事件网格事件架构For an introduction to event schemas, see Azure Event Grid event schema.

可用事件类型Available event types

当客户端通过调用 Azure Cache for Redis REST API 来导出、导入或缩放时,将触发这些事件。These events are triggered when a client exports, imports, or scales by calling Azure Cache for Redis REST APIs. Redis 更新会触发修补事件。Patching event is triggered by Redis update.

事件名称Event name 说明Description
Microsoft.Cache.ExportRDBCompletedMicrosoft.Cache.ExportRDBCompleted 导出缓存数据时触发。Triggered when cache data is exported.
Microsoft.Cache.ImportRDBCompletedMicrosoft.Cache.ImportRDBCompleted 导入缓存数据时触发。Triggered when cache data is imported.
Microsoft.Cache.PatchingCompletedMicrosoft.Cache.PatchingCompleted 修补完成时触发。Triggered when patching is completed.
Microsoft.Cache.ScalingCompletedMicrosoft.Cache.ScalingCompleted 缩放完成时触发。Triggered when scaling is completed.

示例事件Example event

触发某个事件后,事件网格服务会将有关该事件的数据发送到订阅终结点。When an event is triggered, the Event Grid service sends data about that event to subscribing endpoint. 本部分包含一个示例,介绍每个 Azure Cache for Redis 事件的数据外观。This section contains an example of what that data would look like for each Azure Cache for Redis event.

Microsoft.Cache.PatchingCompleted 事件Microsoft.Cache.PatchingCompleted event

[{
"id":"9b87886d-21a5-4af5-8e3e-10c4b8dac73b",
"eventType":"Microsoft.Cache.PatchingCompleted",
"topic":"/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Cache/Redis/{cache_name}",
"data":{
    "name":"PatchingCompleted",
    "timestamp":"2020-12-09T21:50:19.9995668+00:00",
    "status":"Succeeded"},
"subject":"PatchingCompleted",
"dataversion":"1.0",
"metadataVersion":"1",
"eventTime":"2020-12-09T21:50:19.9995668+00:00"}]

Microsoft.Cache.ImportRDBCompleted 事件Microsoft.Cache.ImportRDBCompleted event

[{
"id":"9b87886d-21a5-4af5-8e3e-10c4b8dac73b",
"eventType":"Microsoft.Cache.ImportRDBCompleted",
"topic":"/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Cache/Redis/{cache_name}",
"data":{
    "name":"ImportRDBCompleted",
    "timestamp":"2020-12-09T21:50:19.9995668+00:00",
    "status":"Succeeded"},
"subject":"ImportRDBCompleted",
"dataversion":"1.0",
"metadataVersion":"1",
"eventTime":"2020-12-09T21:50:19.9995668+00:00"}]

Microsoft.Cache.ExportRDBCompleted 事件Microsoft.Cache.ExportRDBCompleted event

[{
"id":"9b87886d-21a5-4af5-8e3e-10c4b8dac73b",
"eventType":"Microsoft.Cache.ExportRDBCompleted",
"topic":"/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Cache/Redis/{cache_name}",
"data":{
    "name":"ExportRDBCompleted",
    "timestamp":"2020-12-09T21:50:19.9995668+00:00",
    "status":"Succeeded"},
"subject":"ExportRDBCompleted",
"dataversion":"1.0",
"metadataVersion":"1",
"eventTime":"2020-12-09T21:50:19.9995668+00:00"}]

Microsoft.Cache.ScalingCompletedMicrosoft.Cache.ScalingCompleted

[{
"id":"9b87886d-21a5-4af5-8e3e-10c4b8dac73b",
"eventType":"Microsoft.Cache.ScalingCompleted",
"topic":"/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Cache/Redis/{cache_name}",
"data":{
    "name":"ScalingCompleted",
    "timestamp":"2020-12-09T21:50:19.9995668+00:00",
    "status":"Succeeded"},
"subject":"ScalingCompleted",
"dataversion":"1.0",
"metadataVersion":"1",
"eventTime":"2020-12-09T21:50:19.9995668+00:00"}]

事件属性Event properties

事件具有以下顶级数据:An event has the following top-level data:

属性Property 类型Type 说明Description
topic stringstring 事件源的完整资源路径。Full resource path to the event source. 此字段不可写入。This field isn't writeable. 事件网格提供此值。Event Grid provides this value.
subject stringstring 事件主题的发布者定义路径。Publisher-defined path to the event subject.
eventType stringstring 此事件源的一个注册事件类型。One of the registered event types for this event source.
eventTime stringstring 基于提供程序 UTC 时间的事件生成时间。The time the event is generated based on the provider's UTC time.
id 字符串string 事件的唯一标识符。Unique identifier for the event.
data 对象object Azure Cache for Redis 事件数据。Azure Cache for Redis event data.
dataVersion stringstring 数据对象的架构版本。The schema version of the data object. 发布者定义架构版本。The publisher defines the schema version.
metadataVersion stringstring 事件元数据的架构版本。The schema version of the event metadata. 事件网格定义顶级属性的架构。Event Grid defines the schema of the top-level properties. 事件网格提供此值。Event Grid provides this value.

数据对象具有以下属性:The data object has the following properties:

属性Property 类型Type 说明Description
timestamp stringstring 发生事件的时间。The time at which the event occurred.
name 字符串string 事件的名称。The name of the event.
status 字符串string 事件的状态。The status of the event. “失败”或“成功”。Failed or succeeded.

快速入门Quickstarts

若要尝试 Azure Cache for Redis 事件,请参阅以下任意快速入门文章:If you want to try Azure Cache for Redis events, see any of these quickstart articles:

若要使用此工具:If you want to use this tool: 请参阅此文:See this article:
Azure 门户Azure portal 快速入门:使用 Azure 门户将 Azure Cache for Redis 事件路由到 Web 终结点Quickstart: Route Azure Cache for Redis events to web endpoint with the Azure portal
PowerShellPowerShell 快速入门:使用 PowerShell 将 Azure Cache for Redis 事件路由到 Web 终结点Quickstart: Route Azure Cache for Redis events to web endpoint with PowerShell
Azure CLIAzure CLI 快速入门:使用 Azure CLI 将 Azure Cache for Redis 事件路由到 Web 终结点Quickstart: Route Azure Cache for Redis events to web endpoint with Azure CLI

后续步骤Next steps