Skip to content

Commit fee45f8

Browse files
committed
More doc updates
1 parent b7b1fae commit fee45f8

File tree

6 files changed

+204
-172
lines changed

6 files changed

+204
-172
lines changed

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

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,23 @@ In the following example, we configure an Exception Policy that will cancel a jo
4444
::: zone pivot="programming-language-csharp"
4545

4646
```csharp
47-
await client.SetExceptionPolicyAsync(
48-
id: "policy-1",
49-
name: "My Exception Policy",
50-
rules: new List<ExceptionRule>
51-
{
52-
new ExceptionRule(
53-
id: "rule-1",
54-
trigger: new QueueLengthExceptionTrigger(threshold: 100),
55-
actions: new List<ExceptionAction>
47+
await routerClient.CreateExceptionPolicyAsync(
48+
new CreateExceptionPolicyOptions(
49+
exceptionPolicyId: "policy-1",
50+
exceptionRules: new List<ExceptionRule>
5651
{
57-
new CancelExceptionAction("cancel-action")
52+
new ExceptionRule(
53+
id: "rule-1",
54+
trigger: new QueueLengthExceptionTrigger(threshold: 100),
55+
actions: new List<ExceptionAction>
56+
{
57+
new CancelExceptionAction("cancel-action")
58+
})
5859
})
59-
});
60+
{
61+
Name = "My exception policy"
62+
}
63+
);
6064
```
6165

6266
::: zone-end
@@ -89,26 +93,30 @@ In the following example, we configure an Exception Policy with rules that will:
8993
::: zone pivot="programming-language-csharp"
9094

9195
```csharp
92-
await client.SetExceptionPolicyAsync(
93-
id: "policy-1",
94-
name: "My Exception Policy",
95-
rules: new List<ExceptionRule>
96-
{
97-
new ExceptionRule(
98-
id: "rule-1",
99-
trigger: new WaitTimeExceptionTrigger(TimeSpan.FromMinutes(1)),
100-
actions: new List<ExceptionAction>
101-
{
102-
new ManualReclassifyExceptionAction(id: "action1", priority: 10)
103-
}),
104-
new ExceptionRule(
105-
id: "rule-2",
106-
trigger: new WaitTimeExceptionTrigger(TimeSpan.FromMinutes(5)),
107-
actions: new List<ExceptionAction>
96+
await routerClient.CreateExceptionPolicyAsync(
97+
new CreateExceptionPolicyOptions(
98+
exceptionPolicyId: "policy-1",
99+
exceptionRules: new List<ExceptionRule>
108100
{
109-
new ManualReclassifyExceptionAction(id: "action2", queueId: "queue-2")
101+
new ExceptionRule(
102+
id: "rule-1",
103+
trigger: new WaitTimeExceptionTrigger(TimeSpan.FromMinutes(1)),
104+
actions: new List<ExceptionAction>
105+
{
106+
new ManualReclassifyExceptionAction(id: "action1", priority: 10)
107+
}),
108+
new ExceptionRule(
109+
id: "rule-2",
110+
trigger: new WaitTimeExceptionTrigger(TimeSpan.FromMinutes(5)),
111+
actions: new List<ExceptionAction>
112+
{
113+
new ManualReclassifyExceptionAction(id: "action2", queueId: "queue-2")
114+
})
110115
})
111-
});
116+
{
117+
Name = "My Exception Policy"
118+
}
119+
);
112120
```
113121

114122
::: zone-end

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

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,28 @@ In the following example we register a worker to
3333
::: zone pivot="programming-language-csharp"
3434

3535
```csharp
36-
var worker = await client.RegisterWorkerAsync(
37-
id: "worker-1",
38-
queueIds: new[] { "queue-1", "queue-2" },
39-
totalCapacity: 2,
40-
channelConfigurations: new List<ChannelConfiguration>
41-
{
42-
new ChannelConfiguration(channelId: "voice", capacityCostPerJob: 2),
43-
new ChannelConfiguration(channelId: "chat", capacityCostPerJob: 1)
44-
},
45-
labels: new LabelCollection()
36+
var worker = await client.CreateWorkerAsync(
37+
new CreateWorkerOptions(
38+
workerId: "worker-1",
39+
totalCapacity: 2)
4640
{
47-
["Skill"] = 11,
48-
["English"] = true,
49-
["French"] = false,
50-
["Vendor"] = "Acme"
41+
QueueIds = new Dictionary<string, QueueAssignment>()
42+
{
43+
["queue-1"] = new QueueAssignment(),
44+
["queue-2"] = new QueueAssignment()
45+
},
46+
ChannelConfigurations = new Dictionary<string, ChannelConfiguration>()
47+
{
48+
["voice"] = new ChannelConfiguration(2),
49+
["chat"] = new ChannelConfiguration(1)
50+
},
51+
Labels = new Dictionary<string, LabelValue>()
52+
{
53+
["Skill"] = new LabelValue(11),
54+
["English"] = new LabelValue(true),
55+
["French"] = new LabelValue(false),
56+
["Vendor"] = new LabelValue("Acme")
57+
},
5158
}
5259
);
5360
```

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ In this example a `StaticRule`, which is a subtype of `RouterRule` can be used t
4242
::: zone pivot="programming-language-csharp"
4343

4444
```csharp
45-
await client.SetClassificationPolicyAsync(
46-
id: "my-policy-id",
47-
prioritizationRule: new StaticRule(5)
48-
);
45+
await routerAdministration.CreateClassificationPolicyAsync(
46+
new CreateClassificationPolicyOptions(classificationPolicyId: "my-policy-id")
47+
{
48+
PrioritizationRule = new StaticRule(new LabelValue(5))
49+
});
4950
```
5051

5152
::: zone-end
@@ -71,10 +72,11 @@ In this example a `ExpressionRule`, which is a subtype of `RouterRule` can be us
7172
::: zone pivot="programming-language-csharp"
7273

7374
```csharp
74-
await client.SetClassificationPolicyAsync(
75-
id: "my-policy-id",
76-
prioritizationRule: new ExpressionRule("If(job.Urgent = true, 10, 5)")
77-
);
75+
await routerAdministration.CreateClassificationPolicyAsync(
76+
new CreateClassificationPolicyOptions(classificationPolicyId: "my-policy-id")
77+
{
78+
PrioritizationRule = new ExpressionRule("If(job.Urgent = true, 10, 5)") // this will check whether the job has a label "Escalated" set to "true"
79+
});
7880
```
7981

8082
::: zone-end

articles/communication-services/how-tos/router-sdk/escalate-job.md

Lines changed: 61 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -35,43 +35,50 @@ Create an exception policy, which you will attach to the regular queue, which is
3535

3636
```csharp
3737
// create the exception policy
38-
await client.SetExceptionPolicyAsync(
39-
id: "Escalate_XBOX_Policy",
40-
name: "Add escalated label and reclassify XBOX Job requests after 5 minutes",
41-
rules: new List<ExceptionRule>()
42-
{
43-
new (
44-
id: "Escalated_Rule",
45-
trigger: new WaitTimeExceptionTrigger(TimeSpan.FromMinutes(5)),
46-
actions: new List<ExceptionAction>
38+
await routerClient.CreateExceptionPolicyAsync(
39+
new CreateExceptionPolicyOptions(
40+
exceptionPolicyId: "Escalate_XBOX_Policy",
41+
exceptionRules: new List<ExceptionRule>()
4742
{
48-
new ReclassifyExceptionAction("EscalateReclassifyExceptionAction")
49-
{
50-
LabelsToUpsert = new LabelCollection(
51-
new Dictionary<string, object>
43+
new (
44+
id: "Escalated_Rule",
45+
trigger: new WaitTimeExceptionTrigger(TimeSpan.FromMinutes(5)),
46+
actions: new List<ExceptionAction>()
5247
{
53-
["Escalated"] = true,
54-
})
55-
}
56-
}
57-
)
58-
});
48+
new ReclassifyExceptionAction("EscalateReclassifyExceptionAction")
49+
{
50+
LabelsToUpsert = new LabelCollection(
51+
new Dictionary<string, object>
52+
{
53+
["Escalated"] = true,
54+
})
55+
}
56+
}
57+
)
58+
{
59+
Name = "My exception policy"
60+
}
61+
);
5962
```
6063

6164
## Classification policy configuration
6265

6366
Create a Classification Policy to handle the new label added to the Job. This policy will evaluate the `Escalated` label and assign the Job to either Queue. The policy will also use the [RulesEngine](../../concepts/router/router-rule-concepts.md) to increase the priority of the Job from `1` to `10`.
6467

6568
```csharp
66-
await client.SetClassificationPolicyAsync(
67-
id: "Classify_XBOX_Voice_Jobs",
68-
name: "Classify XBOX Voice Jobs",
69-
queueSelector: new QueueIdSelector(
70-
new ExpressionRule(
71-
"If(job.Escalated = true, \"XBOX_Queue\", \"XBOX_Escalation_Queue\")")),
72-
workerSelectors: null,
73-
prioritizationRule: new ExpressionRule("If(job.Escalated = true, 10, 1)"),
74-
fallbackQueueId: "Default");
69+
await routerAdministrationClient.CreateClassificationPolicyAsync(
70+
options: new CreateClassificationPolicyOptions("Classify_XBOX_Voice_Jobs")
71+
{
72+
Name = "Classify XBOX Voice Jobs",
73+
PrioritizationRule = new ExpressionRule("If(job.Escalated = true, 10, 1)"),
74+
QueueSelectors = new List<QueueSelectorAttachment>()
75+
{
76+
new QueueIdSelector(
77+
new ExpressionRule(
78+
"If(job.Escalated = true, \"XBOX_Queue\", \"XBOX_Escalation_Queue\")"))
79+
},
80+
FallbackQueueId = "Default"
81+
});
7582
```
7683

7784
## Queue configuration
@@ -83,36 +90,42 @@ Create the necessary Queues for regular and escalated Jobs and assign the Except
8390

8491
```csharp
8592
// create a queue for regular Jobs and attach the exception policy
86-
await client.SetQueueAsync(
87-
id: "XBOX_Queue",
88-
name: "XBOX Queue",
89-
distributionPolicyId: "Round_Robin_Policy",
90-
exceptionPolicyId: "XBOX_Escalate_Policy"
91-
);
93+
await routerAdministrationClient.CreateQueueAsync(
94+
options: new CreateQueueOptions("XBOX_Queue", "Round_Robin_Policy")
95+
{
96+
Name = "XBOX Queue",
97+
ExceptionPolicyId = "XBOX_Escalate_Policy"
98+
});
9299

93100
// create a queue for escalated Jobs
94-
await client.SetQueueAsync(
95-
id: "XBOX_Escalation_Queue",
96-
name: "XBOX Escalation Queue",
97-
distributionPolicyId: "Round_Robin_Policy"
98-
);
101+
await routerAdministrationClient.CreateQueueAsync(
102+
options: new CreateQueueOptions("XBOX_Escalation_Queue", "Round_Robin_Policy")
103+
{
104+
Name = "XBOX Escalation Queue",
105+
});
99106
```
100107

101108
## Job lifecycle
102109

103110
When you submit the Job, specify the Classification Policy ID as follows. For this particular example, the requirement would be to find a worker with a label called `XBOX_Hardware`, which has a value greater than or equal to the number `7`.
104111

105112
```csharp
106-
await client.CreateJobWithClassificationPolicyAsync(
107-
channelId: ManagedChannels.AcsVoiceChannel,
108-
classificationPolicyId: "Classify_XBOX_Voice_Jobs",
109-
workerSelectors: new List<LabelSelector>
113+
await routerClient.CreateJobAsync(
114+
options: new CreateJobWithClassificationPolicyOptions(
115+
jobId: "75c5612e-afb4-4e65-a0bf-3d1b950fad7b",
116+
channelId: ManagedChannels.AcsVoiceChannel,
117+
classificationPolicyId: "Classify_XBOX_Voice_Jobs")
110118
{
111-
new (
112-
key: "XBOX_Hardware",
113-
@operator: LabelOperator.GreaterThanEqual,
114-
value: 7)
115-
}
119+
WorkerSelectors = new List<WorkerSelectorAttachment>
120+
{
121+
new WorkerSelector()
122+
{
123+
Key = "XBOX_Hardware",
124+
Operator = LabelOperator.GreaterThanEqual,
125+
Value = 7
126+
}
127+
}
128+
});
116129
);
117130
```
118131

0 commit comments

Comments
 (0)