共用方式為


訂閱作業路由器事件

本指南概述為作業路由器事件設定訂用帳戶的步驟,以及如何接收這些事件。

如需事件方格的詳細資訊,請參閱事件方格文件

必要條件

建立事件方格訂閱

此範本會在作業路由器事件的儲存體佇列上部署事件方格訂用帳戶。 如果儲存體帳戶、佇列或系統主題不存在,也會加以建立。

部署至 Azure

參數

  • Azure 通訊服務資源名稱:Azure 通訊服務資源的名稱。 例如,如果資源的端點是 https://contoso.communication.azure.net,則設定為 contoso
  • 儲存體名稱:Azure 儲存體帳戶的名稱。 如果不存在,將予以建立。
  • 事件子名稱:要建立的事件訂用帳戶名稱。
  • 系統主題名稱:如果 Azure 通訊服務資源上有現有的事件訂用帳戶,請在 Azure 通訊服務資源的 Events 索引標籤中尋找 System Topic 名稱。 否則,指定唯一的名稱,例如 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://learn.microsoft.com/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

事件目錄

路由器事件

事件 子網域 描述
RouterJobReceived Job 已建立用於路由的新作業
RouterJobClassified Job 分類原則已套用至作業
RouterJobQueued Job 作業已成功排入佇列
RouterJobClassificationFailed Job 路由器無法使用分類原則將作業分類
RouterJobCompleted Job 作業已完成並輸入總結
RouterJobClosed Job 作業已關閉並完成總結
RouterJobCancelled Job 作業已取消
RouterJobExceptionTriggered Job 已觸發作業例外狀況
RouterJobWorkerSelectorsExpired Job 作業上的一或多個背景工作角色選取器已過期
RouterJobUnassigned Job 從背景工作角色將已指派的作業取消指派
RouterJobWaitingForActivation Job 排程作業的要求排程時間已到,路由器正在等候 contoso 處理作業
RouterJobSchedulingFailed Job 儘管已要求排程作業,但路由器無法建立排程作業
RouterWorkerOfferIssued Worker 作業已提供給背景工作角色
RouterWorkerOfferAccepted Worker 已接受提供給背景工作角色的供應項目
RouterWorkerOfferDeclined Worker 已拒絕提供給背景工作角色的供應項目
RouterWorkerOfferRevoked Worker 已撤銷提供給背景工作角色的供應項目
RouterWorkerOfferExpired Worker 提供給背景工作角色的供應項目已過期
RouterWorkerRegistered Worker 已註冊的背景工作角色 (狀態已從非作用中/清空變更為作用中)
RouterWorkerUpdated Worker 下列其中一個背景工作屬性已更新:AvailableForOffers、、、QueueAssignmentsTotalCapacityChannelConfigurations、、 LabelsTags
RouterWorkerDeregistered Worker 已取消註冊背景工作角色 (狀態已從作用中變更為非作用中/清空)

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"
}

屬性清單

屬性 類型 Nullable 描述 附註
jobId string
channelReference string
jobStatus enum 可能的值 PendingClassification,已排入佇列 送出此事件時,分類程序尚未執行,或已使用相關聯的 queueId 建立作業。
channelId string
classificationPolicyId string ✔️ 針對作業指定 queueId 時為 null
queueId string ✔️ 針對作業指定 classificationPolicyId 時為 null
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"
}

屬性清單

屬性 類型 Nullable 描述 附註
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"
}

屬性清單

屬性 類型 Nullable 描述 附註
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"
}

屬性清單

屬性 類型 Nullable 描述 附註
錯誤 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"
}

屬性清單

屬性 類型 Nullable 描述 附註
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"
}

屬性清單

屬性 類型 Nullable 描述 附註
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"
}

屬性清單

屬性 類型 Nullable 描述 附註
注意 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"
}

屬性清單

屬性 類型 Nullable 描述 附註
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"
}

屬性清單

屬性 類型 Nullable 描述 附註
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"
}

屬性清單

屬性 類型 Nullable 描述 附註
jobId string
assignmentId string
workerId string
channelId string
channelReference string
queueId string ✔️ 針對作業指定 classificationPolicyId 時為 null
標籤 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"
}

屬性清單

屬性 類型 Nullable 描述 附註
jobId string
channelId string
channelReference string
queueId string ✔️ 針對作業指定 classificationPolicyId 時為 null
標籤 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"
}

屬性清單

屬性 類型 Nullable 描述 附註
jobId string
channelId string
channelReference string
queueId string ✔️ 針對作業指定 classificationPolicyId 時為 null
標籤 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"
}

屬性清單

屬性 類型 Nullable 描述 附註
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"
}

屬性清單

屬性 類型 Nullable 描述 附註
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"
}

屬性清單

屬性 類型 Nullable 描述 附註
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"
}

屬性清單

屬性 類型 Nullable 描述 附註
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"
}

屬性清單

屬性 類型 Nullable 描述 附註
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"
}

屬性清單

屬性 類型 Nullable 描述 附註
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"
}

屬性清單

屬性 類型 Nullable 描述 附註
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"
}

屬性清單

屬性 類型 Nullable 描述 附註
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,
}