Compartilhar via

Azure Cache for Redis 作为事件网格源

本文提供Azure Cache for Redis事件的属性和架构。 有关事件架构的简介,请参阅Azure 事件网格事件架构

重要

Azure Cache for Redis宣布其所有 SKU 的停用时间表。 建议尽快将现有Azure Cache for Redis实例移动到Azure托管 Redis。

迁移指南:

有关停用的更多详细信息:

可用事件类型

当客户端通过调用 AZURE CACHE FOR REDIS REST API 导出、导入或缩放时触发这些事件。 修补事件由 Redis 更新触发。

事件名称 Description
Microsoft。Cache.ExportRDBCompleted 导出缓存数据时触发。
Microsoft.Cache.ImportRDBCompleted 导入缓存数据时触发。
Microsoft.Cache.PatchingCompleted 修补完成后触发。
Microsoft.Cache.ScalingCompleted 缩放完成后触发。

示例事件

触发某个事件后,事件网格服务会将有关该事件的数据发送到订阅终结点。 本部分包含每个Azure Cache for Redis事件的数据的外观示例。

Microsoft.Cache.PatchingCompleted 事件

[{
	"id": "9b87886d-21a5-4af5-8e3e-10c4b8dac73b",
	"type": "Microsoft.Cache.PatchingCompleted",
	"source": "/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",
	"time": "2020-12-09T21:50:19.9995668+00:00",
    "specversion": "1.0"
}]

Microsoft.Cache.ImportRDBCompleted 事件

[{
	"id": "9b87886d-21a5-4af5-8e3e-10c4b8dac73b",
	"type": "Microsoft.Cache.ImportRDBCompleted",
	"source": "/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",
	"eventTime": "2020-12-09T21:50:19.9995668+00:00",
	"specversion": "1.0"
}]

Microsoft.Cache.ExportRDBCompleted 事件

[{
	"id": "9b87886d-21a5-4af5-8e3e-10c4b8dac73b",
	"type": "Microsoft.Cache.ExportRDBCompleted",
	"source": "/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",
	"time": "2020-12-09T21:50:19.9995668+00:00",
	"specversion": "1.0"
}]

Microsoft.Cache.ScalingCompleted

[{
	"id": "9b87886d-21a5-4af5-8e3e-10c4b8dac73b",
	"type": "Microsoft.Cache.ScalingCompleted",
	"source": "/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",
	"time": "2020-12-09T21:50:19.9995668+00:00",
	"specversion": "1.0"
}]

事件属性

事件具有以下顶级数据:

资产 类型 Description
source 字符串 事件源的完整资源路径。 此字段不可写入。 事件网格提供此值。
subject 字符串 由发布者定义的事件主题路径。
type 字符串 此事件源的一个注册事件类型。
time 字符串 事件生成的时间是基于提供者的 UTC 时间。
id 字符串 事件的唯一标识符。
data 对象 Azure Cache for Redis 事件数据。
specversion 字符串 CloudEvents 架构规范版本。

数据对象具有以下属性:

资产 类型 Description
timestamp 字符串 事件发生的时间。
name 字符串 事件名称。
status 字符串 事件的状态。 失败或成功。

快速入门

若要尝试Azure Cache for Redis事件,请参阅以下任何快速入门文章:

如果要使用此工具: 请参阅本文:
Azure门户 快速入门:使用 Azure 门户将 Azure Cache for Redis 事件路由到 Web 终结点
PowerShell Quickstart:使用 PowerShell 将Azure Cache for Redis事件路由到 Web 终结点
Azure CLI 快速入门:使用 Azure CLI 将 Azure Cache for Redis 事件路由到 web 端点

后续步骤