You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Azure Communication Services Job Router solves the problem of matching supply with demand.
20
20
21
-
A real-world example of this may be call center agents (supply) being matched to incoming support calls (demand).
21
+
A real-world example of this is matching call center agents (supply) to incoming support calls (demand).
22
22
23
23
## Job
24
24
25
-
A Job represents a unit of work (demand), which needs to be routed to an available Worker (supply).
25
+
A Job is a unit of work (demand), which must be routed to an available Worker (supply).
26
26
27
-
A real-world example of this may be an incoming call or chat in the context of a call center.
27
+
A real-world example is an incoming call or chat in the context of a call center.
28
28
29
29
### Job submission flow
30
30
31
31
1. Your application submits a Job via the Job Router SDK.
32
-
2. The Job is classified and a [JobClassified Event][job_classified_event] is sent via EventGrid, which includes all the information about the Job and how the classification process may have modified its properties.
33
-
34
-
:::image type="content" source="../media/router/acs-router-job-submission.png" alt-text="Diagram showing Communication Services' Job Router submitting a job.":::
32
+
2. The Job is classified and a [JobClassified Event][job_classified_event] is sent via Event Grid.
33
+
34
+
:::image type="content" source="../media/router/acs-router-job-submission.png" alt-text="Diagram of job submission.":::
35
35
36
36
## Worker
37
37
38
-
A Worker represents the supply available to handle a Job. Each worker registers with one or more queues to receive jobs.
38
+
A Worker is the supply available to handle a Job. Each worker registers with one or more queues to receive jobs.
39
39
40
-
A real-world example of this may be an agent working in a call center.
40
+
A real-world example is an agent in a call center.
41
41
42
42
### Worker registration flow
43
43
44
44
1. When your Worker is ready to take on work, you can register the worker via the Job Router SDK.
45
45
2. Job Router then sends a [WorkerRegistered Event][worker_registered_event]
:::image type="content" source="../media/router/acs-router-worker-registration.png" alt-text="Diagram of worker registration.":::
48
48
49
49
## Queue
50
50
51
-
A Queue represents an ordered list of jobswaiting to be served by a worker. Workers will register with a queue to receive work from it.
51
+
A Queue is an ordered list of jobs, that are waiting to be served by a worker. Workers register with a queue to receive work from it.
52
52
53
-
A real-world example of this may be a call queue in a call center.
53
+
A real-world example is a call queue in a call center.
54
54
55
55
## Channel
56
56
57
-
A Channel represents a grouping of jobs by some type. When a worker registers to receive work, they must also specify for which channels they can handle work, and how much of each can they handle concurrently. Channels are just a string discriminator and aren't explicitly created.
57
+
A Channel is a grouping of jobs by some type. When a worker registers to receive work, they must also specify for which channels they can handle work, and how much of each can they handle concurrently. Channels are just a string discriminator and aren't explicitly created.
58
58
59
-
A real-world example of this may be`voice calls` or `chats` in a call center.
59
+
A real-world examples are`voice calls` or `chats` in a call center.
60
60
61
61
## Offer
62
62
63
-
An Offer is extended by JobRouter to a worker to handle a particular job when it determines a match. When this happens, you'll be notified via [EventGrid][subscribe_events]. You can either accept or decline the offer using the JobRouter SDK, or it will expire according to the time to live configured on the Distribution Policy.
63
+
An Offer is extended by Job Router to a worker to handle a particular job when it determines a match. You can either accept or decline the offer with the JobRouter SDK. If you ignore the offer, it expires according to the time to live configured on the Distribution Policy.
64
64
65
-
A real-world example of this may be the ringing of an agent in a call center.
65
+
A real-world example is the ringing of an agent in a call center.
66
66
67
67
### Offer flow
68
68
69
-
1. When Job Router finds a matching Worker for a Job, it offers the work by sending a[OfferIssued Event][offer_issued_event] via EventGrid.
69
+
1. When Job Router finds a matching Worker for a Job, it creates ab Offer and sends an[OfferIssued Event][offer_issued_event] via [Event Grid][subscribe_events].
70
70
2. The Offer is accepted via the Job Router API.
71
-
3. Job Router sends a[OfferAccepted Event][offer_accepted_event] signifying to the Contoso Application the Worker is assigned to the Job.
A Distribution Policy represents a configuration set that controls how jobs in a queue are distributed to workers registered with that queue.
77
+
A Distribution Policy is a configuration set that controls how jobs in a queue are distributed to workers registered with that queue.
78
78
This configuration includes:
79
79
80
80
- How long an Offer is valid before it expires.
@@ -83,27 +83,27 @@ This configuration includes:
83
83
84
84
### Distribution modes
85
85
86
-
The 3 types of modes are
86
+
The three types of modes are
87
87
88
88
-**Round Robin**: Workers are ordered by `Id` and the next worker after the previous one that got an offer is picked.
89
89
-**Longest Idle**: The worker that has not been working on a job for the longest.
90
-
-**Best Worker**: The workers that are best able to handle the job will be picked first. The logic to determine this can be optionally customized by specifying an expression or azure function to compare 2 workers and determine which one to pick.
90
+
-**Best Worker**: The workers that are best able to handle the job are picked first. The logic to rank Workers can be customized, with an expression or Azure function to compare two workers.
91
91
92
92
## Labels
93
93
94
-
You can attach labels to workers, jobs, and queues. These are key value pairs that can be of `string`, `number` or `boolean` data types.
94
+
You can attach labels to workers, jobs, and queues. Labels are key value pairs that can be of `string`, `number`, or `boolean` data types.
95
95
96
-
A real-world example of this may be the skill level of a particular worker or the team or geographic location.
96
+
A real-world example is the skill level of a particular worker or the team or geographic location.
97
97
98
98
## Label selectors
99
99
100
-
Label selectors can be attached to a job in order to target a subset of workers serving the queue.
100
+
Label selectors can be attached to a job in order to target a subset of workers on the queue.
101
101
102
-
A real-world example of this may be a condition on an incoming call that the agent must have a minimum level of knowledge of a particular product.
102
+
A real-world example is a condition on an incoming call that the agent must have a minimum level of knowledge of a particular product.
103
103
104
104
## Classification policy
105
105
106
-
A classification policy can be used to dynamically select a queue, determine job priority and attach worker label selectors to a job by leveraging a rules engine.
106
+
A classification policy can be used to programmatically select a queue, determine job priority, or attach worker label selectors to a job.
107
107
108
108
## Exception policy
109
109
@@ -117,7 +117,8 @@ An exception policy controls the behavior of a Job based on a trigger and execut
titleSuffix: An Azure Communication Services how-to guide
4
+
description: Use Azure Communication Services SDKs to target a job to a specific worker
5
+
author: danielgerlag
6
+
ms.author: danielgerlag
7
+
ms.service: azure-communication-services
8
+
ms.topic: how-to
9
+
ms.date: 01/31/2022
10
+
ms.custom: template-how-to
11
+
zone_pivot_groups: acs-js-csharp
12
+
13
+
#Customer intent: As a developer, I want to target a specific worker
14
+
---
15
+
16
+
# Target a Preferred Worker
17
+
18
+
In the context of a call center, customers might be assigned an account manager or have a relationship with a specific worker. As such, You'd want to route a specific job to a specific worker if possible.
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
25
+
- A deployed Communication Services resource. [Create a Communication Services resource](../../quickstarts/create-communication-resource.md).
26
+
- Optional: Complete the quickstart to [get started with Job Router](../../quickstarts/router/get-started-router.md)
27
+
28
+
## Setup worker selectors
29
+
30
+
Every worker automatically has an `Id` label. You can apply worker selectors to the job, to target a specific worker.
31
+
32
+
In the following example, a job is created that targets a specific worker. If that worker does not accept the job within the TTL of 1 minute, the condition for the specific worker is no longer be valid and the job could go to any worker.
33
+
34
+
::: zone pivot="programming-language-csharp"
35
+
36
+
```csharp
37
+
awaitclient.CreateJobAsync(
38
+
channelId: "<channel id>",
39
+
queueId: "<queue id>",
40
+
workerSelectors: newList<LabelSelector>
41
+
{
42
+
newLabelSelector(
43
+
key: "Id",
44
+
@operator: LabelOperator.Equal,
45
+
value: "<preferred worker id>",
46
+
ttl: TimeSpan.FromMinutes(1))
47
+
});
48
+
```
49
+
50
+
::: zone-end
51
+
52
+
::: zone pivot="programming-language-javascript"
53
+
54
+
```typescript
55
+
awaitclient.createJob({
56
+
channelId: "<channel id>",
57
+
queueId: "<queue id>",
58
+
workerSelectors: [
59
+
{
60
+
key: "Id",
61
+
operator: "equal",
62
+
value: "<preferred worker id>",
63
+
ttl: "00:01:00"
64
+
}
65
+
]
66
+
});
67
+
```
68
+
69
+
::: zone-end
70
+
71
+
> [!TIP]
72
+
> You could also use any custom label that is unique to each worker.
0 commit comments