Skip to content

Commit 02a0345

Browse files
authored
Merge pull request #186934 from danielgerlag/jobrouter/preferred-worker
Preferred Worker article
2 parents afaebd4 + 95b1bb0 commit 02a0345

File tree

2 files changed

+99
-26
lines changed

2 files changed

+99
-26
lines changed

articles/communication-services/concepts/router/concepts.md

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,63 +18,63 @@ ms.service: azure-communication-services
1818

1919
Azure Communication Services Job Router solves the problem of matching supply with demand.
2020

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).
2222

2323
## Job
2424

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).
2626

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.
2828

2929
### Job submission flow
3030

3131
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.":::
3535

3636
## Worker
3737

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.
3939

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.
4141

4242
### Worker registration flow
4343

4444
1. When your Worker is ready to take on work, you can register the worker via the Job Router SDK.
4545
2. Job Router then sends a [WorkerRegistered Event][worker_registered_event]
4646

47-
:::image type="content" source="../media/router/acs-router-worker-registration.png" alt-text="Diagram showing Communication Services' Job Router worker registration.":::
47+
:::image type="content" source="../media/router/acs-router-worker-registration.png" alt-text="Diagram of worker registration.":::
4848

4949
## Queue
5050

51-
A Queue represents an ordered list of jobs waiting 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.
5252

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.
5454

5555
## Channel
5656

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.
5858

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.
6060

6161
## Offer
6262

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.
6464

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.
6666

6767
### Offer flow
6868

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].
7070
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.
71+
3. Job Router sends an [OfferAccepted Event][offer_accepted_event].
7272

7373
:::image type="content" source="../media/router/acs-router-accept-offer.png" alt-text="Diagram showing Communication Services' Job Router accept offer.":::
7474

7575
## Distribution Policy
7676

77-
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.
7878
This configuration includes:
7979

8080
- How long an Offer is valid before it expires.
@@ -83,27 +83,27 @@ This configuration includes:
8383

8484
### Distribution modes
8585

86-
The 3 types of modes are
86+
The three types of modes are
8787

8888
- **Round Robin**: Workers are ordered by `Id` and the next worker after the previous one that got an offer is picked.
8989
- **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.
9191

9292
## Labels
9393

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.
9595

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.
9797

9898
## Label selectors
9999

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.
101101

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.
103103

104104
## Classification policy
105105

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.
107107

108108
## Exception policy
109109

@@ -117,7 +117,8 @@ An exception policy controls the behavior of a Job based on a trigger and execut
117117
- [Exception Policies](exception-policy.md)
118118
- [Quickstart guide](../../quickstarts/router/get-started-router.md)
119119
- [Manage queues](../../how-tos/router-sdk/manage-queue.md)
120-
- [Classifying a Job](../../how-tos/router-sdk/job-classification.md)
120+
- [How to classify a Job](../../how-tos/router-sdk/job-classification.md)
121+
- [Target a preferred worker](../../how-tos/router-sdk/preferred-worker.md)
121122
- [Escalate a Job](../../how-tos/router-sdk/escalate-job.md)
122123
- [Subscribe to events](../../how-tos/router-sdk/subscribe-events.md)
123124

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
title: Target a Preferred Worker
3+
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.
19+
20+
[!INCLUDE [Private Preview Disclaimer](../../includes/private-preview-include-section.md)]
21+
22+
## Prerequisites
23+
24+
- 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+
await client.CreateJobAsync(
38+
channelId: "<channel id>",
39+
queueId: "<queue id>",
40+
workerSelectors: new List<LabelSelector>
41+
{
42+
new LabelSelector(
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+
await client.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

Comments
 (0)