本指南概述了为作业路由器事件设置订阅的步骤以及如何接收这些事件。
有关事件网格的更多详细信息,请参阅事件网格文档。
先决条件
创建事件网格订阅
此模板在作业路由器事件存储队列上部署事件网格订阅。
如果存储帐户、队列或系统主题不存在,也会创建这些订阅。
参数
- Azure 通信服务资源名称:Azure 通信服务资源的名称。 例如,如果资源的终结点为
https://contoso.communication.azure.net,则将其设置为 contoso。
- 存储名称:Azure 存储帐户的名称。 如果该表不存在,将创建该表。
- 事件子名称:要创建的事件订阅的名称。
- 系统主题名称:如果 Azure 通信服务资源上已有事件订阅,请查找 Azure 通信服务资源的 选项卡中的
System Topic 名称。Events 否则,请指定唯一名称,例如 Azure 通信服务资源本身的名称。
- 队列名称:存储帐户内队列的名称。 如果该表不存在,将创建该表。
已部署资源
将以下资源作为解决方案的一部分进行部署
- 存储帐户:如果存储帐户名称不存在。
- 存储队列:如果存储帐户中不存在队列。
- 事件网格系统主题:如果主题不存在。
- 事件网格订阅:存储队列中所有作业路由器事件的订阅。
快速入门:通过 Azure 存储队列接收事件网格事件
新建 C# 应用程序
在控制台窗口(例如 cmd、PowerShell 或 Bash)中,使用 dotnet new 命令创建名为 EventReceiver 的新控制台应用。 此命令将创建包含单个源文件的简单“Hello World”C# 项目:Program.cs。
dotnet new console -o EventReceiver
将目录更改为新创建的应用文件夹,并使用 dotnet build 命令编译应用程序。
cd EventReceiver
dotnet build
安装包
安装 Azure 存储队列和事件网格包。
dotnet add package Azure.Storage.Queues
dotnet add package Azure.Messaging.EventGrid
从队列接收消息
复制以下代码片段,并将其粘贴到源文件 Program.cs 中
using Azure.Storage.Queues;
using Azure.Messaging.EventGrid;
// For more detailed tutorials on storage queues, see: https://free.blessedness.top/azure/storage/queues/storage-tutorial-queues
var queueClient = new QueueClient("<Storage Account Connection String>", "router-events");
while (true)
{
var msg = await queueClient.ReceiveMessageAsync();
if (msg.Value == null)
{
await Task.Delay(TimeSpan.FromSeconds(1));
continue;
}
var json = Convert.FromBase64String(msg.Value.Body.ToString());
var evt = EventGridEvent.Parse(BinaryData.FromBytes(json));
Console.WriteLine($"Received event: {evt.EventType} - {evt.Subject} - {evt.Data}");
await queueClient.DeleteMessageAsync(msg.Value.MessageId, msg.Value.PopReceipt);
}
运行代码
从应用程序目录使用 dotnet run 命令运行应用程序。
dotnet run
事件目录
路由器事件
Microsoft.Communication.RouterJobReceived
返回到事件目录
{
"id": "acdf8fa5-8ab4-4a65-874a-c1d2a4a97f2e",
"topic": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/Microsoft.Communication/communicationServices/{communication-services-resource-name}",
"subject": "job/{job-id}/channel/{channel-id}",
"data": {
"jobId": "7f1df17b-570b-4ae5-9cf5-fe6ff64cc712",
"channelReference": "test-abc",
"jobStatus": "PendingClassification",
"channelId": "FooVoiceChannelId",
"classificationPolicyId": "test-policy",
"queueId": "queue-id",
"priority": 0,
"labels": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
},
"tags": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
},
"requestedWorkerSelectors": [
{
"key": "string",
"labelOperator": "equal",
"value": 5,
"ttlSeconds": 50,
"expirationTime": "2022-02-17T00:58:25.1736293Z"
}
],
"scheduledOn": "3/28/2007 7:13:50 PM +00:00",
"unavailableForMatching": false
},
"eventType": "Microsoft.Communication.RouterJobReceived",
"dataVersion": "1.0",
"metadataVersion": "1",
"eventTime": "2022-02-17T00:55:25.1736293Z"
}
属性列表
| Attribute |
类型 |
可为空值 |
说明 |
注释 |
| jobId |
string |
❌ |
|
|
| channelReference |
string |
❌ |
|
|
| jobStatus |
enum |
❌ |
可能的值 PendingClassification、Queued |
当此事件发出时,分类进程尚未执行,或者已使用关联的 queueId 创建了作业。 |
| channelId |
string |
❌ |
|
|
| classificationPolicyId |
string |
✔️ |
|
为作业指定 null 时为 queueId |
| queueId |
string |
✔️ |
|
为作业指定 null 时为 classificationPolicyId |
| priority |
int |
✔️ |
|
指定 classificationPolicyId 时为 Null。 如果是直接队列分配,则为非 NULL 值。 |
| 标签 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| 标记 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| requestedWorkerSelectors |
List<WorkerSelector> |
✔️ |
|
根据用户输入 |
| scheduledOn |
DateTimeOffset |
✔️ |
|
根据用户输入 |
| unavailableForMatching |
bool |
✔️ |
|
根据用户输入 |
Microsoft.Communication.RouterJobClassified
返回到事件目录
{
"id": "b6d8687a-5a1a-42ae-b8b5-ff7ec338c872",
"topic": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/Microsoft.Communication/communicationServices/{communication-services-resource-name}",
"subject": "job/{job-id}/channel/{channel-id}/queue/{queue-id}",
"data": {
"queueDetails": {
"id": "625fec06-ab81-4e60-b780-f364ed96ade1",
"name": "Queue 1",
"labels": {
"Language": "en",
"Product": "Office",
"Geo": "NA"
}
},
"jobId": "7f1df17b-570b-4ae5-9cf5-fe6ff64cc712",
"channelReference": "test-abc",
"channelId": "FooVoiceChannelId",
"classificationPolicyId": "test-policy",
"queueId": "625fec06-ab81-4e60-b780-f364ed96ade1",
"priority": 5,
"labels": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
},
"tags": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
},
"attachedWorkerSelectors": [
{
"key": "string",
"labelOperator": "equal",
"value": 5,
"ttlSeconds": 60.0
}
]
},
"eventType": "Microsoft.Communication.RouterJobClassified",
"dataVersion": "1.0",
"metadataVersion": "1",
"eventTime": "2022-02-17T00:55:25.1736293Z"
}
属性列表
| Attribute |
类型 |
可为空值 |
说明 |
注释 |
| queueDetails |
QueueDetails |
❌ |
|
|
| jobId |
string |
❌ |
|
|
| channelReference |
string |
❌ |
|
|
| channelId |
string |
❌ |
|
|
| classificationPolicyId |
string |
❌ |
|
|
| queueId |
string |
❌ |
|
|
| priority |
int |
❌ |
|
|
| 标签 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| 标记 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| attachedWorkerSelectors |
List<WorkerSelector> |
✔️ |
|
分类策略附加的辅助角色选择器列表 |
Microsoft.Communication.RouterJobQueued
返回到事件目录
{
"id": "b6d8687a-5a1a-42ae-b8b5-ff7ec338c872",
"topic": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/Microsoft.Communication/communicationServices/{communication-services-resource-name}",
"subject": "job/{job-id}/channel/{channel-id}/queue/{queue-id}",
"data": {
"jobId": "7f1df17b-570b-4ae5-9cf5-fe6ff64cc712",
"channelReference": "test-abc",
"channelId": "FooVoiceChannelId",
"queueId": "625fec06-ab81-4e60-b780-f364ed96ade1",
"priority": 1,
"labels": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
},
"tags": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
},
"requestedWorkerSelectors": [
{
"key": "string",
"labelOperator": "equal",
"value": 5,
"ttlSeconds": 60.0
}
],
"attachedWorkerSelectors": [
{
"key": "string",
"labelOperator": "equal",
"value": 5,
"ttlSeconds": 60.0
}
]
},
"eventType": "Microsoft.Communication.RouterJobQueued",
"dataVersion": "1.0",
"metadataVersion": "1",
"eventTime": "2022-02-17T00:55:25.1736293Z"
}
属性列表
| Attribute |
类型 |
可为空值 |
说明 |
注释 |
| jobId |
string |
❌ |
|
|
| channelReference |
string |
✔️ |
|
|
| channelId |
string |
❌ |
|
|
| queueId |
string |
❌ |
|
|
| priority |
int |
❌ |
|
|
| 标签 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| 标记 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| requestedWorkerSelectors |
List<WorkerSelector> |
✔️ |
|
创建作业时基于用户输入 |
| attachedWorkerSelectors |
List<WorkerSelector> |
✔️ |
|
分类策略附加的辅助角色选择器列表 |
Microsoft.Communication.RouterJobClassificationFailed
返回到事件目录
{
"id": "b6d8687a-5a1a-42ae-b8b5-ff7ec338c872",
"topic": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/Microsoft.Communication/communicationServices/{communication-services-resource-name}",
"subject": "job/{job-id}/channel/{channel-id}/classificationpolicy/{classificationpolicy-id}",
"data": {
"errors": [
{
"code": null,
"message": "Classification failed due to <reason>",
"target": null,
"innerError": null,
"details": null
}
],
"jobId": "7f1df17b-570b-4ae5-9cf5-fe6ff64cc712",
"channelReference": "test-abc",
"channelId": "FooVoiceChannelId",
"classificationPolicyId": "test-policy",
"labels": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
},
"tags": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
}
},
"eventType": "Microsoft.Communication.RouterJobClassificationFailed",
"dataVersion": "1.0",
"metadataVersion": "1",
"eventTime": "2022-02-17T00:55:25.1736293Z"
}
属性列表
| Attribute |
类型 |
可为空值 |
说明 |
注释 |
| 错误 |
List<CommunicationError> |
❌ |
|
|
| jobId |
string |
❌ |
|
|
| channelReference |
string |
❌ |
|
|
| channelId |
string |
❌ |
|
|
| classificationPolicyId |
string |
❌ |
|
|
| 标签 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| 标记 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
Microsoft.Communication.RouterJobCompleted
返回到事件目录
{
"id": "b6d8687a-5a1a-42ae-b8b5-ff7ec338c872",
"topic": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/Microsoft.Communication/communicationServices/{communication-services-resource-name}",
"subject": "job/{job-id}/channel/{channel-id}/assignment/{assignment-id}",
"data": {
"jobId": "7f1df17b-570b-4ae5-9cf5-fe6ff64cc712",
"channelReference": "test-abc",
"channelId": "FooVoiceChannelId",
"queueId": "queue-id",
"assignmentId": "6f1df17b-570b-4ae5-9cf5-fe6ff64cc712",
"labels": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
},
"tags": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
},
"workerId": "e3a3f2f9-3582-4bfe-9c5a-aa57831a0f88"
},
"eventType": "Microsoft.Communication.RouterJobCompleted",
"dataVersion": "1.0",
"metadataVersion": "1",
"eventTime": "2022-02-17T00:55:25.1736293Z"
}
属性列表
| Attribute |
类型 |
可为空值 |
说明 |
注释 |
| jobId |
string |
❌ |
|
|
| channelReference |
string |
❌ |
|
|
| channelId |
string |
❌ |
|
|
| queueId |
string |
❌ |
|
|
| 标签 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| 标记 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| assignmentId |
string |
❌ |
|
|
| workerId |
string |
❌ |
|
|
Microsoft.Communication.RouterJobClosed
返回到事件目录
{
"id": "b6d8687a-5a1a-42ae-b8b5-ff7ec338c872",
"topic": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/Microsoft.Communication/communicationServices/{communication-services-resource-name}",
"subject": "job/{job-id}/channel/{channel-id}/assignment/{assignment-id}",
"data": {
"jobId": "7f1df17b-570b-4ae5-9cf5-fe6ff64cc712",
"channelReference": "test-abc",
"channelId": "FooVoiceChannelId",
"queueId": "",
"dispositionCode": "",
"workerId": "",
"assignmentId": "",
"labels": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
},
"tags": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
}
},
"eventType": "Microsoft.Communication.RouterJobClosed",
"dataVersion": "1.0",
"metadataVersion": "1",
"eventTime": "2022-02-17T00:55:25.1736293Z"
}
属性列表
| Attribute |
类型 |
可为空值 |
说明 |
注释 |
| jobId |
string |
❌ |
|
|
| channelReference |
string |
❌ |
|
|
| channelId |
string |
❌ |
|
|
| queueId |
string |
❌ |
|
|
| 标签 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| 标记 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| dispositionCode |
string |
✔️ |
|
根据用户输入 |
| workerId |
string |
❌ |
|
|
| assignmentId |
string |
❌ |
|
|
Microsoft.Communication.RouterJobCancelled
返回到事件目录
{
"id": "b6d8687a-5a1a-42ae-b8b5-ff7ec338c872",
"topic": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/Microsoft.Communication/communicationServices/{communication-services-resource-name}",
"subject": "job/{job-id}/channel/{channel-id}/disposition/{disposition-code}",
"data": {
"note": "Cancelled due to <reason>",
"dispositionCode": "100",
"jobId": "7f1df17b-570b-4ae5-9cf5-fe6ff64cc712",
"channelReference": "test-abc",
"channelId": "FooVoiceChannelId",
"labels": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
},
"tags": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
},
"queueId": ""
},
"eventType": "Microsoft.Communication.RouterJobCancelled",
"dataVersion": "1.0",
"metadataVersion": "1",
"eventTime": "2022-02-17T00:55:25.1736293Z"
}
属性列表
| Attribute |
类型 |
可为空值 |
说明 |
注释 |
| 备注 |
string |
✔️ |
|
根据用户输入 |
| dispositionCode |
string |
❌ |
|
|
| jobId |
string |
❌ |
|
|
| channelReference |
string |
❌ |
|
|
| channelId |
string |
❌ |
|
|
| 标签 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| 标记 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| queueId |
string |
✔️ |
|
|
Microsoft.Communication.RouterJobExceptionTriggered
返回到事件目录
{
"id": "1027db4a-17fe-4a7f-ae67-276c3120a29f",
"topic": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/Microsoft.Communication/communicationServices/{communication-services-resource-name}",
"subject": "job/{job-id}/channel/{channel-id}/exceptionrule/{rulekey}",
"data": {
"ruleKey": "r100",
"exceptionRuleId": "7f1df17b-570b-4ae5-9cf5-fe6ff64cc712",
"jobId": "7f1df17b-570b-4ae5-9cf5-fe6ff64cc712",
"channelReference": "test-abc",
"channelId": "FooVoiceChannelId",
"labels": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
},
"tags": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
}
},
"eventType": "Microsoft.Communication.RouterJobExceptionTriggered",
"dataVersion": "1.0",
"metadataVersion": "1",
"eventTime": "2022-02-17T00:55:25.1736293Z"
}
属性列表
| Attribute |
类型 |
可为空值 |
说明 |
注释 |
| ruleKey |
string |
❌ |
|
|
| exceptionRuleId |
string |
❌ |
|
|
| jobId |
string |
❌ |
|
|
| channelReference |
string |
❌ |
|
|
| channelId |
string |
❌ |
|
|
| 标签 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| 标记 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
Microsoft.Communication.RouterJobWorkerSelectorsExpired
返回到事件目录
{
"id": "b6d8687a-5a1a-42ae-b8b5-ff7ec338c872",
"topic": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/Microsoft.Communication/communicationServices/{communication-services-resource-name}",
"subject": "job/{job-id}/channel/{channel-id}/queue/{queue-id}",
"data": {
"jobId": "7f1df17b-570b-4ae5-9cf5-fe6ff64cc712",
"channelReference": "test-abc",
"channelId": "FooVoiceChannelId",
"queueId": "625fec06-ab81-4e60-b780-f364ed96ade1",
"labels": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
},
"tags": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
},
"expiredRequestedWorkerSelectors": [
{
"key": "string",
"labelOperator": "equal",
"value": 5,
"ttlSeconds": 60.0
}
],
"expiredAttachedWorkerSelectors": [
{
"key": "string",
"labelOperator": "equal",
"value": 5,
"ttlSeconds": 60.0
}
]
},
"eventType": "Microsoft.Communication.RouterJobWorkerSelectorsExpired",
"dataVersion": "1.0",
"metadataVersion": "1",
"eventTime": "2022-02-17T00:55:25.1736293Z"
}
属性列表
| Attribute |
类型 |
可为空值 |
说明 |
注释 |
| jobId |
string |
❌ |
|
|
| channelReference |
string |
✔️ |
|
|
| queueId |
string |
❌ |
|
|
| channelId |
string |
❌ |
|
|
| 标签 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| 标记 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| expiredRequestedWorkerSelectors |
List<WorkerSelector> |
✔️ |
|
创建作业时基于用户输入 |
| expiredAttachedWorkerSelectors |
List<WorkerSelector> |
✔️ |
|
分类策略附加的辅助角色选择器列表 |
Microsoft.Communication.RouterJobUnassigned
返回到事件目录
{
"id": "acdf8fa5-8ab4-4a65-874a-c1d2a4a97f2e",
"topic": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/Microsoft.Communication/communicationServices/{communication-services-resource-name}",
"subject": "job/{job-id}/channel/{channel-id}/assignment/{assignment-id}",
"data": {
"jobId": "7f1df17b-570b-4ae5-9cf5-fe6ff64cc712",
"assignmentId": "",
"workerId": "",
"channelId": "FooVoiceChannelId",
"channelReference": "test-abc",
"queueId": "queue-id",
"labels": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
},
"tags": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
}
},
"eventType": "Microsoft.Communication.RouterJobUnassigned",
"dataVersion": "1.0",
"metadataVersion": "1",
"eventTime": "2022-02-17T00:55:25.1736293Z"
}
属性列表
| Attribute |
类型 |
可为空值 |
说明 |
注释 |
| jobId |
string |
❌ |
|
|
| assignmentId |
string |
❌ |
|
|
| workerId |
string |
❌ |
|
|
| channelId |
string |
❌ |
|
|
| channelReference |
string |
❌ |
|
|
| queueId |
string |
✔️ |
|
为作业指定 null 时为 classificationPolicyId |
| 标签 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| 标记 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
Microsoft.Communication.RouterJobWaitingForActivation
返回到事件目录
{
"id": "acdf8fa5-8ab4-4a65-874a-c1d2a4a97f2e",
"topic": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/Microsoft.Communication/communicationServices/{communication-services-resource-name}",
"subject": "job/{job-id}/channel/{channel-id}",
"data": {
"jobId": "7f1df17b-570b-4ae5-9cf5-fe6ff64cc712",
"channelId": "FooVoiceChannelId",
"channelReference": "test-abc",
"queueId": "queue-id",
"priority": 1,
"labels": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
},
"tags": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
},
"requestedWorkerSelectors": [
{
"key": "string",
"labelOperator": "equal",
"value": 5,
"ttlSeconds": 60.0
}
],
"attachedWorkerSelectors": [
{
"key": "string",
"labelOperator": "equal",
"value": 5,
"ttlSeconds": 60.0
}
],
"scheduledOn": "2022-02-17T00:55:25.1736293Z",
"unavailableForMatching": false
},
"eventType": "Microsoft.Communication.RouterJobWaitingForActivation",
"dataVersion": "1.0",
"metadataVersion": "1",
"eventTime": "2022-02-17T00:55:25.1736293Z"
}
属性列表
| Attribute |
类型 |
可为空值 |
说明 |
注释 |
| jobId |
string |
❌ |
|
|
| channelId |
string |
❌ |
|
|
| channelReference |
string |
❌ |
|
|
| queueId |
string |
✔️ |
|
为作业指定 null 时为 classificationPolicyId |
| 标签 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| 标记 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| requestedWorkerSelectorsExpired |
List<WorkerSelector> |
✔️ |
|
创建作业时基于用户输入 |
| attachedWorkerSelectorsExpired |
List<WorkerSelector> |
✔️ |
|
分类策略附加的辅助角色选择器列表 |
| scheduledOn |
DateTimeOffset |
✔️ |
|
创建作业时基于用户输入 |
| unavailableForMatching |
bool |
✔️ |
|
创建作业时基于用户输入 |
| priority |
int |
❌ |
|
创建作业时基于用户输入 |
Microsoft.Communication.RouterJobSchedulingFailed
返回到事件目录
{
"id": "acdf8fa5-8ab4-4a65-874a-c1d2a4a97f2e",
"topic": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/Microsoft.Communication/communicationServices/{communication-services-resource-name}",
"subject": "job/{job-id}/channel/{channel-id}",
"data": {
"jobId": "7f1df17b-570b-4ae5-9cf5-fe6ff64cc712",
"channelId": "FooVoiceChannelId",
"channelReference": "test-abc",
"queueId": "queue-id",
"priority": 1,
"labels": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
},
"tags": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
},
"requestedWorkerSelectors": [
{
"key": "string",
"labelOperator": "equal",
"value": 5,
"ttlSeconds": 60.0
}
],
"attachedWorkerSelectors": [
{
"key": "string",
"labelOperator": "equal",
"value": 5,
"ttlSeconds": 60.0
}
],
"scheduledOn": "2022-02-17T00:55:25.1736293Z",
"failureReason": "Error"
},
"eventType": "Microsoft.Communication.RouterJobSchedulingFailed",
"dataVersion": "1.0",
"metadataVersion": "1",
"eventTime": "2022-02-17T00:55:25.1736293Z"
}
属性列表
| Attribute |
类型 |
可为空值 |
说明 |
注释 |
| jobId |
string |
❌ |
|
|
| channelId |
string |
❌ |
|
|
| channelReference |
string |
❌ |
|
|
| queueId |
string |
✔️ |
|
为作业指定 null 时为 classificationPolicyId |
| 标签 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| 标记 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| requestedWorkerSelectorsExpired |
List<WorkerSelector> |
✔️ |
|
创建作业时基于用户输入 |
| attachedWorkerSelectorsExpired |
List<WorkerSelector> |
✔️ |
|
分类策略附加的辅助角色选择器列表 |
| scheduledOn |
DateTimeOffset |
✔️ |
|
创建作业时基于用户输入 |
| failureReason |
string |
✔️ |
|
系统确定 |
| priority |
int |
❌ |
|
创建作业时基于用户输入 |
辅助角色事件
Microsoft.Communication.RouterWorkerOfferIssued
返回到事件目录
{
"id": "1027db4a-17fe-4a7f-ae67-276c3120a29f",
"topic": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/Microsoft.Communication/communicationServices/{communication-services-resource-name}",
"subject": "worker/{worker-id}/job/{job-id}",
"data": {
"workerId": "w100",
"jobId": "7f1df17b-570b-4ae5-9cf5-fe6ff64cc712",
"channelReference": "test-abc",
"channelId": "FooVoiceChannelId",
"queueId": "625fec06-ab81-4e60-b780-f364ed96ade1",
"offerId": "525fec06-ab81-4e60-b780-f364ed96ade1",
"offeredOn": "2021-06-23T02:43:30.3847144Z",
"expiresOn": "2021-06-23T02:44:30.3847674Z",
"jobPriority": 5,
"jobLabels": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
},
"jobTags": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
}
},
"eventType": "Microsoft.Communication.RouterWorkerOfferIssued",
"dataVersion": "1.0",
"metadataVersion": "1",
"eventTime": "2022-02-17T00:55:25.1736293Z"
}
属性列表
| Attribute |
类型 |
可为空值 |
说明 |
注释 |
| workerId |
string |
❌ |
|
|
| jobId |
string |
❌ |
|
|
| channelReference |
string |
❌ |
|
|
| channelId |
string |
❌ |
|
|
| queueId |
string |
❌ |
|
|
| offerId |
string |
❌ |
|
|
| offeredOn |
DateTimeOffset |
❌ |
|
|
| expiresOn |
DateTimeOffset |
❌ |
|
|
| jobPriority |
int |
❌ |
|
|
| jobLabels |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| jobTags |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
Microsoft.Communication.RouterWorkerOfferAccepted
返回到事件目录
{
"id": "1027db4a-17fe-4a7f-ae67-276c3120a29f",
"topic": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/Microsoft.Communication/communicationServices/{communication-services-resource-name}",
"subject": "worker/{worker-id}/job/{job-id}",
"data": {
"workerId": "w100",
"jobId": "7f1df17b-570b-4ae5-9cf5-fe6ff64cc712",
"jobPriority": 5,
"jobLabels": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
},
"jobTags": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
},
"workerLabels": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
},
"workerTags": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
},
"channelReference": "test-abc",
"channelId": "FooVoiceChannelId",
"queueId": "625fec06-ab81-4e60-b780-f364ed96ade1",
"offerId": "565fec06-ab81-4e60-b780-f364ed96ade1",
"assignmentId": "765fec06-ab81-4e60-b780-f364ed96ade1"
},
"eventType": "Microsoft.Communication.RouterWorkerOfferAccepted",
"dataVersion": "1.0",
"metadataVersion": "1",
"eventTime": "2022-02-17T00:55:25.1736293Z"
}
属性列表
| Attribute |
类型 |
可为空值 |
说明 |
注释 |
| workerId |
string |
❌ |
|
|
| jobId |
string |
❌ |
|
|
| jobPriority |
int |
❌ |
|
|
| jobLabels |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| jobTags |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| workerLabels |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| workerTags |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| channelReference |
string |
❌ |
|
|
| channelId |
string |
❌ |
|
|
| queueId |
string |
❌ |
|
|
| offerId |
string |
❌ |
|
|
| assignmentId |
string |
❌ |
|
|
Microsoft.Communication.RouterWorkerOfferDeclined
返回到事件目录
{
"id": "1027db4a-17fe-4a7f-ae67-276c3120a29f",
"topic": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/Microsoft.Communication/communicationServices/{communication-services-resource-name}",
"subject": "worker/{worker-id}/job/{job-id}",
"data": {
"workerId": "w100",
"jobId": "7f1df17b-570b-4ae5-9cf5-fe6ff64cc712",
"channelReference": "test-abc",
"channelId": "FooVoiceChannelId",
"queueId": "625fec06-ab81-4e60-b780-f364ed96ade1",
"offerId": "565fec06-ab81-4e60-b780-f364ed96ade1",
},
"eventType": "Microsoft.Communication.RouterWorkerOfferDeclined",
"dataVersion": "1.0",
"metadataVersion": "1",
"eventTime": "2022-02-17T00:55:25.1736293Z"
}
属性列表
| Attribute |
类型 |
可为空值 |
说明 |
注释 |
| workerId |
string |
❌ |
|
|
| jobId |
string |
❌ |
|
|
| channelReference |
string |
❌ |
|
|
| channelId |
string |
❌ |
|
|
| queueId |
string |
❌ |
|
|
| offerId |
string |
❌ |
|
|
Microsoft.Communication.RouterWorkerOfferRevoked
返回到事件目录
{
"id": "1027db4a-17fe-4a7f-ae67-276c3120a29f",
"topic": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/Microsoft.Communication/communicationServices/{communication-services-resource-name}",
"subject": "worker/{worker-id}/job/{job-id}",
"data": {
"offerId": "565fec06-ab81-4e60-b780-f364ed96ade1",
"workerId": "w100",
"jobId": "7f1df17b-570b-4ae5-9cf5-fe6ff64cc712",
"channelReference": "test-abc",
"channelId": "FooVoiceChannelId",
"queueId": "625fec06-ab81-4e60-b780-f364ed96ade1"
},
"eventType": "Microsoft.Communication.RouterWorkerOfferRevoked",
"dataVersion": "1.0",
"metadataVersion": "1",
"eventTime": "2022-02-17T00:55:25.1736293Z"
}
属性列表
| Attribute |
类型 |
可为空值 |
说明 |
注释 |
| offerId |
string |
❌ |
|
|
| workerId |
string |
❌ |
|
|
| jobId |
string |
❌ |
|
|
| channelReference |
string |
❌ |
|
|
| channelId |
string |
❌ |
|
|
| queueId |
string |
❌ |
|
|
Microsoft.Communication.RouterWorkerOfferExpired
返回到事件目录
{
"id": "1027db4a-17fe-4a7f-ae67-276c3120a29f",
"topic": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/Microsoft.Communication/communicationServices/{communication-services-resource-name}",
"subject": "worker/{worker-id}/job/{job-id}",
"data": {
"offerId": "565fec06-ab81-4e60-b780-f364ed96ade1",
"workerId": "w100",
"jobId": "7f1df17b-570b-4ae5-9cf5-fe6ff64cc712",
"channelReference": "test-abc",
"channelId": "FooVoiceChannelId",
"queueId": "625fec06-ab81-4e60-b780-f364ed96ade1"
},
"eventType": "Microsoft.Communication.RouterWorkerOfferExpired",
"dataVersion": "1.0",
"metadataVersion": "1",
"eventTime": "2022-02-17T00:55:25.1736293Z"
}
属性列表
| Attribute |
类型 |
可为空值 |
说明 |
注释 |
| workerId |
string |
❌ |
|
|
| offerId |
string |
❌ |
|
|
| jobId |
string |
❌ |
|
|
| channelReference |
string |
❌ |
|
|
| channelId |
string |
❌ |
|
|
| queueId |
string |
❌ |
|
|
Microsoft.Communication.RouterWorkerRegistered
返回到事件目录
{
"id": "1027db4a-17fe-4a7f-ae67-276c3120a29f",
"topic": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/Microsoft.Communication/communicationServices/{communication-services-resource-name}",
"subject": "worker/{worker-id}",
"data": {
"workerId": "worker3",
"totalCapacity": 100,
"queueAssignments": [
{
"id": "MyQueueId2",
"name": "Queue 3",
"labels": {
"Language": "en",
"Product": "Office",
"Geo": "NA"
}
}
],
"labels": {
"x": "111",
"y": "111"
},
"channelConfigurations": [
{
"channelId": "FooVoiceChannelId",
"capacityCostPerJob": 10,
"maxNumberOfJobs": 5
}
],
"tags": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
}
},
"eventType": "Microsoft.Communication.RouterWorkerRegistered",
"dataVersion": "1.0",
"metadataVersion": "1",
"eventTime": "2022-02-17T00:55:25.1736293Z"
}
属性列表
| Attribute |
类型 |
可为空值 |
说明 |
注释 |
| workerId |
string |
❌ |
|
|
| totalCapacity |
int |
❌ |
|
|
| queueAssignments |
List<QueueDetails> |
❌ |
|
|
| 标签 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| channelConfigurations |
List<ChannelConfiguration> |
❌ |
|
|
| 标记 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
Microsoft.Communication.RouterWorkerUpdated
返回到事件目录
{
"id": "1027db4a-17fe-4a7f-ae67-276c3120a29f",
"topic": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/Microsoft.Communication/communicationServices/{communication-services-resource-name}",
"subject": "worker/{worker-id}",
"data": {
"workerId": "worker3",
"availableForOffers": true,
"totalCapacity": 100,
"queueAssignments": [
{
"id": "MyQueueId2",
"name": "Queue 3",
"labels": {
"Language": "en",
"Product": "Office",
"Geo": "NA"
}
}
],
"labels": {
"x": "111",
"y": "111"
},
"channelConfigurations": [
{
"channelId": "FooVoiceChannelId",
"capacityCostPerJob": 10,
"maxNumberOfJobs": 5
}
],
"tags": {
"Locale": "en-us",
"Segment": "Enterprise",
"Token": "FooToken"
},
"updatedWorkerProperties": [
"TotalCapacity",
"Labels",
"Tags",
"ChannelConfigurations",
"AvailableForOffers",
"QueueAssignments"
]
},
"eventType": "Microsoft.Communication.RouterWorkerUpdated",
"dataVersion": "1.0",
"metadataVersion": "1",
"eventTime": "2022-02-17T00:55:25.1736293Z"
}
属性列表
| Attribute |
类型 |
可为空值 |
说明 |
注释 |
| workerId |
string |
❌ |
|
|
| totalCapacity |
int |
❌ |
|
|
| queueAssignments |
List<QueueDetails> |
❌ |
|
|
| 标签 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| channelConfigurations |
List<ChannelConfiguration> |
❌ |
|
|
| 标记 |
Dictionary<string, object> |
✔️ |
|
根据用户输入 |
| updatedWorkerProperties |
List<UpdateWorkerProperty> |
❌ |
已更新辅助角色属性,其中包括 AvailableForOffers、QueueAssignments、ChannelConfigurations、TotalCapacity、Labels 和 Tags |
|
Microsoft.Communication.RouterWorkerDeregistered
返回到事件目录
{
"id": "1027db4a-17fe-4a7f-ae67-276c3120a29f",
"topic": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/Microsoft.Communication/communicationServices/{communication-services-resource-name}",
"subject": "worker/{worker-id}",
"data": {
"workerId": "worker3"
},
"eventType": "Microsoft.Communication.RouterWorkerDeregistered",
"dataVersion": "1.0",
"metadataVersion": "1",
"eventTime": "2022-02-17T00:55:25.1736293Z"
}
属性列表
| Attribute |
类型 |
可为空值 |
说明 |
注释 |
| workerId |
string |
❌ |
|
|
模型定义
QueueDetails
public class QueueDetails
{
public string Id { get; set; }
public string Name { get; set; }
public Dictionary<string, object>? Labels { get; set; }
}
CommunicationError
public class CommunicationError
{
public string? Code { get; init; }
public string Message { get; init; }
public string? Target { get; init; }
public CommunicationError? InnerError { get; init; }
public IEnumerable<CommunicationError>? Details { get; init; }
}
ChannelConfiguration
public class ChannelConfiguration
{
public string ChannelId { get; set; }
public int CapacityCostPerJob { get; set; }
public int? MaxNumberOfJobs { get; set; }
}
UpdatedWorkerProperty
public enum UpdatedWorkerProperty
{
AvailableForOffers,
Capacity,
QueueAssignments,
Labels,
Tags,
ChannelConfigurations
}
WorkerSelector
public class WorkerSelector
{
public string Key { get; set; }
public LabelOperator LabelOperator { get; set; }
public object Value { get; set; }
public double? TTLSeconds { get; set; }
public WorkerSelectorState State { get; set; }
public DateTimeOffset? ExpirationTime { get; set; }
}
public enum WorkerSelectorState
{
Active = 0,
Expired = 1
}
public enum LabelOperator
{
Equal,
NotEqual,
LessThan,
LessThanEqual,
GreaterThan,
GreaterThanEqual,
}