Skip to content

Commit fdf0212

Browse files
committed
Fix mistakes
1 parent fccaad1 commit fdf0212

File tree

4 files changed

+59
-84
lines changed

4 files changed

+59
-84
lines changed

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

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,20 @@ await routerClient.CreateExceptionPolicyAsync(
4040
exceptionPolicyId: "Escalate_XBOX_Policy",
4141
exceptionRules: new Dictionary<string, ExceptionRule>()
4242
{
43-
new (
44-
{
45-
["Escalated_Rule"] =
43+
{
44+
["Escalated_Rule"] = new ExceptionRule(new WaitTimeExceptionTrigger(300),
45+
new Dictionary<string, ExceptionAction>()
4646
{
47-
id: "Escalated_Rule",
48-
trigger: new WaitTimeExceptionTrigger(TimeSpan.FromMinutes(5)),
49-
actions: new List<ExceptionAction>()
50-
{
51-
new ReclassifyExceptionAction("EscalateReclassifyExceptionAction")
47+
"EscalateReclassifyExceptionAction" = new ReclassifyExceptionAction(
48+
classificationPolicyId: "<classification policy id>",
49+
labelsToUpsert: new Dictionary<string, object>()
5250
{
53-
LabelsToUpsert = new LabelCollection(
54-
new Dictionary<string, object>
55-
{
56-
["Escalated"] = true,
57-
})
58-
}
59-
}
60-
}
61-
}
62-
)
51+
["Escalated"] = true,
52+
})
53+
})
54+
}
55+
}
56+
))
6357
{
6458
Name = "My exception policy"
6559
}
@@ -78,14 +72,18 @@ await routerAdministrationClient.CreateClassificationPolicyAsync(
7872
PrioritizationRule = new ExpressionRule("If(job.Escalated = true, 10, 1)"),
7973
QueueSelectors = new List<QueueSelectorAttachment>()
8074
{
81-
new QueueLabelSelector()
82-
{
83-
LabelSelectors = new List<LabelSelectorAttachment>
75+
new ConditionalQueueSelectorAttachment(
76+
condition: new ExpressionRule("If(job.Escalated = true, true, false)"),
77+
labelSelectors: new List<QueueSelector>()
8478
{
85-
new ExpressionRule(
86-
"If(job.Escalated = true, \"XBOX_Queue\", \"XBOX_Escalation_Queue\")"))
87-
}
88-
}
79+
new QueueSelector("Id", LabelOperator.Equal, new LabelValue("XBOX_Escalation_Queue"))
80+
}),
81+
new ConditionalQueueSelectorAttachment(
82+
condition: new ExpressionRule("If(job.Escalated = false, true, false)"),
83+
labelSelectors: new List<QueueSelector>()
84+
{
85+
new QueueSelector("Id", LabelOperator.Equal, new LabelValue("XBOX_Queue"))
86+
})
8987
},
9088
FallbackQueueId = "Default"
9189
});

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

Lines changed: 30 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,18 @@ await routerAdministrationClient.CreateClassificationPolicyAsync(
3939
PrioritizationRule = new ExpressionRule("If(job.Hardware_VIP = true, 10, 1)"),
4040
QueueSelectors = new List<QueueSelectorAttachment>()
4141
{
42-
new QueueLabelSelector()
43-
{
44-
LabelSelectors = new List<LabelSelectorAttachment>
42+
new ConditionalQueueSelectorAttachment(
43+
condition: new ExpressionRule("If(job.Region = \"NA\", true, false)"),
44+
labelSelectors: new List<QueueSelector>()
4545
{
46-
new ExpressionRule("If(job.Region = \"NA\", \"XBOX_NA_QUEUE\", \"XBOX_DEFAULT_QUEUE\")")
47-
}
48-
}
46+
new QueueSelector("Id", LabelOperator.Equal, new LabelValue("XBOX_NA_QUEUE"))
47+
}),
48+
new ConditionalQueueSelectorAttachment(
49+
condition: new ExpressionRule("If(job.Escalated = \"NA\", false, true)"),
50+
labelSelectors: new List<QueueSelector>()
51+
{
52+
new QueueSelector("Id", LabelOperator.Equal, new LabelValue("XBOX_DEFAULT_QUEUE"))
53+
})
4954
}
5055
});
5156
```
@@ -131,15 +136,7 @@ await routerAdministrationClient.CreateClassificationPolicyAsync(
131136
{
132137
WorkerSelectors = new List<WorkerSelectorAttachment>()
133138
{
134-
new StaticWorkerSelectorAttachment()
135-
{
136-
LabelSelector = new WorkerSelector()
137-
{
138-
Key = "Foo",
139-
LabelOperator = LabelOperator.Equal,
140-
Value = "Bar"
141-
}
142-
}
139+
new StaticWorkerSelectorAttachment(new WorkerSelector("Foo", LabelOperator.Equal, new LabelValue("Bar")))
143140
}
144141
});
145142
```
@@ -174,19 +171,12 @@ await routerAdministrationClient.CreateClassificationPolicyAsync(
174171
{
175172
WorkerSelectors = new List<WorkerSelectorAttachment>()
176173
{
177-
new ConditionalWorkerSelectorAttachment()
178-
{
179-
Condition = new ExpressionRule("job.Urgent = true"),
180-
LabelSelectors = new List<WorkerSelector>
174+
new ConditionalWorkerSelectorAttachment(
175+
condition: new ExpressionRule("job.Urgent = true")),
176+
labelSelectors: new List<WorkerSelector>()
181177
{
182-
new WorkerSelector()
183-
{
184-
Key = "Foo",
185-
LabelOperator = LabelOperator.Equal,
186-
Value = "Bar"
187-
}
178+
new WorkerSelector("Foo", LabelOperator.Equal, "Bar")
188179
})
189-
}
190180
}
191181
});
192182
```
@@ -227,7 +217,7 @@ await routerAdministrationClient.CreateClassificationPolicyAsync(
227217
{
228218
WorkerSelectors = new List<WorkerSelectorAttachment>()
229219
{
230-
new PassThroughLabelSelector(key: "Foo", @operator: LabelOperator.Equal)
220+
new PassThroughQueueSelectorAttachment("Foo", LabelOperator.Equal)
231221
}
232222
});
233223
```
@@ -263,22 +253,20 @@ await routerAdministrationClient.CreateClassificationPolicyAsync(
263253
{
264254
WorkerSelectors = new List<WorkerSelectorAttachment>()
265255
{
266-
new WeightedAllocationWorkerSelectorAttachment()
267-
{
268-
Weight = 0.3,
269-
LabelSelectors = new List<WorkerSelector>
270-
{
271-
new WorkerSelector("Vendor", LabelOperator.Equal, "A")
272-
})
273-
},
274-
new WeightedAllocationWorkerSelectorAttachment()
275-
{
276-
Weight = 0.7,
277-
LabelSelectors = new List<WorkerSelector>
256+
new WeightedAllocationWorkerSelectorAttachment(
257+
new List<WorkerWeightedAllocation>()
278258
{
279-
new WorkerSelector("Vendor", LabelOperator.Equal, "B")
259+
new WorkerWeightedAllocation(0.3,
260+
new List<WorkerSelector>()
261+
{
262+
new WorkerSelector("Vendor", LabelOperator.Equal, "A")
263+
}),
264+
new WorkerWeightedAllocation(0.7,
265+
new List<WorkerSelector>()
266+
{
267+
new WorkerSelector("Vendor", LabelOperator.Equal, "B")
268+
})
280269
})
281-
}
282270
}
283271
});
284272
```
@@ -326,12 +314,7 @@ var reclassifiedJob = await routerClient.ReclassifyJobAsync("<job id>");
326314
::: zone pivot="programming-language-javascript"
327315
328316
```typescript
329-
await client.reclassifyJob("<jobId>", {
330-
classificationPolicyId: null,
331-
labelsToUpdate: {
332-
Hardware_VIP: true
333-
}
334-
});
317+
await client.reclassifyJob("<jobId>");
335318
```
336319
337320
::: zone-end

articles/communication-services/how-tos/router-sdk/manage-queue.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ The Job Router SDK will update an existing queue when the `UpdateQueue` or `Upda
5656
var queue = await administrationClient.UpdateQueueAsync(
5757
options: new UpdateQueueOptions("XBOX_DEFAULT_QUEUE")
5858
{
59+
QueueId = "XBOX_DEFAULT_QUEUE",
60+
Name = "XBOX Default Queue",
61+
DistributionPolicyId = "Longest_Idle_45s_Min1Max10",
5962
Labels = new Dictionary<string, LabelValue>()
6063
{
6164
["Additional-Queue-Label"] = new LabelValue("ChatQueue")
6265
}
6366
});
64-
id: "",
65-
name: "XBOX Default Queue",
66-
distributionPolicy: "Longest_Idle_45s_Min1Max10"
6767
);
6868
```
6969

articles/communication-services/how-tos/router-sdk/preferred-worker.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,13 @@ In the following example, a job is created that targets a specific worker. If th
3636
```csharp
3737
await routerClient.CreateJobAsync(
3838
options: new CreateJobOptions(
39-
jobId: "89f0274f-555c-4f38-9dd2-966a44b32f8c",
39+
jobId: "<job id>",
4040
channelId: "<channel id>",
4141
queueId: "<queue id>")
4242
{
43-
RequestedWorkerSelectors = new List<WorkerSelector>
43+
RequestedWorkerSelectors = new List<WorkerSelector>()
4444
{
45-
new WorkerSelector()
46-
{
47-
Key = "Id",
48-
Operator = LabelOperator.Equal,
49-
Value = "<preferred worker id>",
50-
TTL = TimeSpan.FromMinutes(1)
51-
}
45+
new WorkerSelector("Id", LabelOperator.Equal, "<preferred worker id>", TimeSpan.FromMinutes(1))
5246
}
5347
});
5448
```

0 commit comments

Comments
 (0)