Skip to content

Commit 7e161ba

Browse files
Merge pull request #245812 from williamzhao87/williamzhao/update-quickstarts
[JobRouter] Update quickstarts
2 parents 4ec13ff + 424921e commit 7e161ba

File tree

3 files changed

+34
-21
lines changed

3 files changed

+34
-21
lines changed

articles/communication-services/quickstarts/router/includes/router-quickstart-java.md

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ However, we could also wait a few seconds and then query the worker directly aga
178178
Thread.sleep(3000);
179179
worker = routerClient.getWorker(worker.getId());
180180
for (RouterJobOffer offer : worker.getOffers()) {
181-
System.out.printf("Worker %s has an active offer for job %s", worker.getId(), offer.getJobId());
181+
System.out.printf("Worker %s has an active offer for job %s\n", worker.getId(), offer.getJobId());
182182
}
183183
```
184184

@@ -188,26 +188,35 @@ Then, the worker can accept the job offer by using the SDK, which assigns the jo
188188

189189
```java
190190
AcceptJobOfferResult accept = routerClient.acceptJobOffer(worker.getId(), worker.getOffers().get(0).getOfferId());
191-
System.out.printf("Worker %s is assigned job %s", worker.getId(), accept.getJobId());
191+
System.out.printf("Worker %s is assigned job %s\n", worker.getId(), accept.getJobId());
192192
```
193193

194194
## Complete the job
195195

196196
Once the worker has completed the work associated with the job (for example, completed the call), we complete the job.
197197

198198
```java
199-
routerClient.completeJob(new CompleteJobOptions("job-1", accept.getAssignmentId()));
200-
System.out.printf("Worker %s has completed job %s", worker.getId(), accept.getJobId());
199+
routerClient.completeJob(new CompleteJobOptions(accept.getJobId(), accept.getAssignmentId()));
200+
System.out.printf("Worker %s has completed job %s\n", worker.getId(), accept.getJobId());
201201
```
202202

203203
## Close the job
204204

205205
Once the worker is ready to take on new jobs, the worker should close the job. Optionally, the worker can provide a disposition code to indicate the outcome of the job.
206206

207207
```java
208-
routerClient.closeJob(new CloseJobOptions("job-1", accept.getAssignmentId())
208+
routerClient.closeJob(new CloseJobOptions(accept.getJobId(), accept.getAssignmentId())
209209
.setDispositionCode("Resolved"));
210-
System.out.printf("Worker %s has closed job %s", worker.getId(), accept.getJobId());
210+
System.out.printf("Worker %s has closed job %s\n", worker.getId(), accept.getJobId());
211+
```
212+
213+
## Delete the job
214+
215+
Once the job has been closed, we can delete the job so that we can re-create the job with the same ID if we run this sample again
216+
217+
```javascript
218+
routerClient.deleteJob(accept.getJobId());
219+
System.out.printf("Deleting job %s\n", accept.getJobId());
211220
```
212221

213222
## Run the code
@@ -234,11 +243,11 @@ The expected output describes each completed action:
234243

235244
```console
236245
Azure Communication Services - Job Router Quickstart
237-
238-
Worker worker-1 has an active offer for job 6b83c5ad-5a92-4aa8-b986-3989c791be91
239-
Worker worker-1 is assigned job 6b83c5ad-5a92-4aa8-b986-3989c791be91
240-
Worker worker-1 has completed job 6b83c5ad-5a92-4aa8-b986-3989c791be91
241-
Worker worker-1 has closed job 6b83c5ad-5a92-4aa8-b986-3989c791be91
246+
Worker worker-1 has an active offer for job job-1
247+
Worker worker-1 is assigned job job-1
248+
Worker worker-1 has completed job job-1
249+
Worker worker-1 has closed job job-1
250+
Deleting job job-1
242251
```
243252

244253
> [!NOTE]

articles/communication-services/quickstarts/router/includes/router-quickstart-javascript.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ console.log(`Worker ${worker.id} is assigned job ${accept.jobId}`);
162162
Once the worker has completed the work associated with the job (for example, completed the call), we complete the job.
163163

164164
```javascript
165-
await routerClient.completeJob("job-1", accept.assignmentId);
165+
await routerClient.completeJob(accept.jobId, accept.assignmentId);
166166
console.log(`Worker ${worker.id} has completed job ${accept.jobId}`);
167167
```
168168

@@ -171,7 +171,7 @@ console.log(`Worker ${worker.id} has completed job ${accept.jobId}`);
171171
Once the worker is ready to take on new jobs, the worker should close the job. Optionally, the worker can provide a disposition code to indicate the outcome of the job.
172172

173173
```javascript
174-
await routerClient.closeJob("job-1", accept.assignmentId, { dispositionCode: "Resolved" });
174+
await routerClient.closeJob(accept.jobId, accept.assignmentId, { dispositionCode: "Resolved" });
175175
console.log(`Worker ${worker.id} has closed job ${accept.jobId}`);
176176
```
177177

@@ -191,10 +191,12 @@ To run the code, make sure you are on the directory where your `index.js` file i
191191
```console
192192
node index.js
193193

194-
Worker worker-1 has an active offer for job 6b83c5ad-5a92-4aa8-b986-3989c791be91
195-
Worker worker-1 is assigned job 6b83c5ad-5a92-4aa8-b986-3989c791be91
196-
Worker worker-1 has completed job 6b83c5ad-5a92-4aa8-b986-3989c791be91
197-
Worker worker-1 has closed job 6b83c5ad-5a92-4aa8-b986-3989c791be91
194+
Azure Communication Services - Job Router Quickstart
195+
Worker worker-1 has an active offer for job job-1
196+
Worker worker-1 is assigned job job-1
197+
Worker worker-1 has completed job job-1
198+
Worker worker-1 has closed job job-1
199+
Deleting job job-1
198200
```
199201

200202
> [!NOTE]

articles/communication-services/quickstarts/router/includes/router-quickstart-python.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ print(f"Worker {worker.id} has closed job {accept.job_id}")
193193
## Delete the job
194194

195195
Once the job has been closed, we can delete the job so that we can re-create the job with the same ID if we run this sample again
196+
196197
```python
197198
router_client.delete_job(accept.job_id)
198199
print(f"Deleting {accept.job_id}")
@@ -206,10 +207,11 @@ To run the code, make sure you are on the directory where your `router-quickstar
206207
python router-quickstart.py
207208

208209
Azure Communication Services - Job Router Quickstart
209-
Worker worker-1 has an active offer for job 6b83c5ad-5a92-4aa8-b986-3989c791be91
210-
Worker worker-1 is assigned job 6b83c5ad-5a92-4aa8-b986-3989c791be91
211-
Worker worker-1 has completed job 6b83c5ad-5a92-4aa8-b986-3989c791be91
212-
Worker worker-1 has closed job 6b83c5ad-5a92-4aa8-b986-3989c791be91
210+
Worker worker-1 has an active offer for job job-1
211+
Worker worker-1 is assigned job job-1
212+
Worker worker-1 has completed job job-1
213+
Worker worker-1 has closed job job-1
214+
Deleting job job-1
213215
```
214216

215217
> [!NOTE]

0 commit comments

Comments
 (0)