Target a Preferred Worker
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.
Prerequisites
- An Azure account with an active subscription. Create an account for free.
- A deployed Communication Services resource. Create a Communication Services resource.
- Optional: Complete the quickstart to get started with Job Router
Setup worker selectors
Every worker automatically has an Id
label. You can apply worker selectors to the job, to target a specific worker.
In the following example, a job is created that targets a specific worker. If that worker does not accept the job within the offer expiry duration of 1 minute, the condition for the specific worker is no longer be valid and the job could go to any worker.
await client.CreateJobAsync(
new CreateJobOptions(jobId: "job1", channelId: "Xbox_Chat_Channel", queueId: queue.Value.Id)
{
RequestedWorkerSelectors =
{
new RouterWorkerSelector(key: "Id", labelOperator: LabelOperator.Equal, value: new RouterValue("<preferred_worker_id>")) {
Expedite = true,
ExpiresAfter = TimeSpan.FromSeconds(45)
}
}
});
await client.path("/routing/jobs/{jobId}", "job1").patch({
body: {
channelId: "Xbox_Chat_Channel",
queueId: queue.body.id,
requestedWorkerSelectors: [
{
key: "Id",
labelOperator: "equal",
value: "<preferred worker id>",
expiresAfterSeconds: 45
}]
},
contentType: "application/merge-patch+json"
});
client.upsert_job(job_id = "job1",
channel_id = "Xbox_Chat_Channel",
queue_id = queue.id,
requested_worker_selectors = [
RouterWorkerSelector(
key = "Id",
label_operator = LabelOperator.EQUAL,
value = "<preferred worker id>",
expires_after_seconds = 45
)
]
)
client.createJob(new CreateJobOptions("job1", "Xbox_Chat_Channel", queue.getId())
.setRequestedWorkerSelectors(List.of(
new RouterWorkerSelector("Id", LabelOperator.EQUAL, new RouterValue("<preferred_worker_id>"))
.setExpiresAfter(Duration.ofSeconds(45.0))
.setExpedite(true))));
Tip
You could also use any custom label that is unique to each worker.
Σχόλια
https://aka.ms/ContentUserFeedback.
Σύντομα διαθέσιμα: Καθ' όλη τη διάρκεια του 2024 θα καταργήσουμε σταδιακά τα ζητήματα GitHub ως μηχανισμό ανάδρασης για το περιεχόμενο και θα το αντικαταστήσουμε με ένα νέο σύστημα ανάδρασης. Για περισσότερες πληροφορίες, ανατρέξτε στο θέμα:Υποβολή και προβολή σχολίων για