-
Notifications
You must be signed in to change notification settings - Fork 328
Expand file tree
/
Copy pathLocalOrchestrationService.cs
More file actions
709 lines (597 loc) · 26.1 KB
/
Copy pathLocalOrchestrationService.cs
File metadata and controls
709 lines (597 loc) · 26.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
// ----------------------------------------------------------------------------------
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------
namespace DurableTask.Emulator
{
using DurableTask.Core;
using DurableTask.Core.Common;
using DurableTask.Core.Exceptions;
using DurableTask.Core.History;
using Newtonsoft.Json;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using DurableTask.Core.Entities;
/// <summary>
/// Fully functional in-proc orchestration service for testing
/// </summary>
public class LocalOrchestrationService : IOrchestrationService, IOrchestrationServiceClient, IEntityOrchestrationService, IDisposable
{
// ReSharper disable once NotAccessedField.Local
Dictionary<string, byte[]> sessionState;
readonly List<TaskMessage> timerMessages;
readonly int MaxConcurrentWorkItems = 20;
// dictionary<instanceId, dictionary<executionId, orchestrationState>>
////Dictionary<string, Dictionary<string, OrchestrationState>> instanceStore;
readonly PeekLockSessionQueue orchestratorQueue;
readonly PeekLockQueue workerQueue;
readonly CancellationTokenSource cancellationTokenSource;
readonly Dictionary<string, Dictionary<string, OrchestrationState>> instanceStore;
//Dictionary<string, Tuple<List<TaskMessage>, byte[]>> sessionLock;
readonly object thisLock = new object();
readonly object timerLock = new object();
readonly ConcurrentDictionary<string, TaskCompletionSource<OrchestrationState>> orchestrationWaiters;
static readonly JsonSerializerSettings StateJsonSettings = new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.Auto,
SerializationBinder = new HistoryEventSerializationBinder()
};
/// <summary>
/// Creates a new instance of the LocalOrchestrationService with default settings
/// </summary>
public LocalOrchestrationService()
{
this.orchestratorQueue = new PeekLockSessionQueue();
this.workerQueue = new PeekLockQueue();
this.sessionState = new Dictionary<string, byte[]>();
this.timerMessages = new List<TaskMessage>();
this.instanceStore = new Dictionary<string, Dictionary<string, OrchestrationState>>();
this.orchestrationWaiters = new ConcurrentDictionary<string, TaskCompletionSource<OrchestrationState>>();
this.cancellationTokenSource = new CancellationTokenSource();
}
async Task TimerMessageSchedulerAsync()
{
while (!this.cancellationTokenSource.Token.IsCancellationRequested)
{
lock (this.timerLock)
{
foreach (TaskMessage tm in this.timerMessages.ToList())
{
var te = tm.Event as TimerFiredEvent;
if (te == null)
{
// TODO : unobserved task exception (AFFANDAR)
throw new InvalidOperationException("Invalid timer message");
}
if (te.FireAt <= DateTime.UtcNow)
{
this.orchestratorQueue.SendMessage(tm);
this.timerMessages.Remove(tm);
}
}
}
await Task.Delay(TimeSpan.FromSeconds(1));
}
}
/******************************/
// management methods
/******************************/
/// <inheritdoc />
public Task CreateAsync()
{
return CreateAsync(true);
}
/// <inheritdoc />
public Task CreateAsync(bool recreateInstanceStore)
{
return Task.FromResult<object>(null);
}
/// <inheritdoc />
public Task CreateIfNotExistsAsync()
{
return Task.FromResult<object>(null);
}
/// <inheritdoc />
public Task DeleteAsync()
{
return DeleteAsync(true);
}
/// <inheritdoc />
public Task DeleteAsync(bool deleteInstanceStore)
{
return Task.FromResult<object>(null);
}
/// <inheritdoc />
public Task StartAsync()
{
Task.Run(() => TimerMessageSchedulerAsync());
return Task.FromResult<object>(null);
}
/// <inheritdoc />
public Task StopAsync(bool isForced)
{
this.cancellationTokenSource.Cancel();
return Task.FromResult<object>(null);
}
/// <inheritdoc />
public Task StopAsync()
{
return StopAsync(false);
}
/// <summary>
/// Determines whether is a transient or not.
/// </summary>
/// <param name="exception">The exception.</param>
/// <returns>
/// <c>true</c> if is transient exception; otherwise, <c>false</c>.
/// </returns>
public bool IsTransientException(Exception exception)
{
return false;
}
/******************************/
// client methods
/******************************/
/// <inheritdoc />
public Task CreateTaskOrchestrationAsync(TaskMessage creationMessage)
{
return CreateTaskOrchestrationAsync(creationMessage, null);
}
/// <inheritdoc />
public virtual Task CreateTaskOrchestrationAsync(TaskMessage creationMessage, OrchestrationStatus[] dedupeStatuses)
{
var ee = creationMessage.Event as ExecutionStartedEvent;
if (ee == null)
{
throw new InvalidOperationException("Invalid creation task message");
}
lock (this.thisLock)
{
if (!this.instanceStore.TryGetValue(creationMessage.OrchestrationInstance.InstanceId, out Dictionary<string, OrchestrationState> ed))
{
ed = new Dictionary<string, OrchestrationState>();
this.instanceStore[creationMessage.OrchestrationInstance.InstanceId] = ed;
}
OrchestrationState latestState = ed.Values.OrderBy(state => state.CreatedTime).FirstOrDefault(state => state.OrchestrationStatus != OrchestrationStatus.ContinuedAsNew);
if (latestState != null && (dedupeStatuses == null || dedupeStatuses.Contains(latestState.OrchestrationStatus)))
{
// An orchestration with same instance id is already running
throw new OrchestrationAlreadyExistsException($"An orchestration with id '{creationMessage.OrchestrationInstance.InstanceId}' already exists. It is in state {latestState.OrchestrationStatus}");
}
var newState = new OrchestrationState
{
OrchestrationInstance = new OrchestrationInstance
{
InstanceId = creationMessage.OrchestrationInstance.InstanceId,
ExecutionId = creationMessage.OrchestrationInstance.ExecutionId,
},
CreatedTime = DateTime.UtcNow,
LastUpdatedTime = DateTime.UtcNow,
OrchestrationStatus = OrchestrationStatus.Pending,
Version = ee.Version,
Name = ee.Name,
Input = ee.Input,
ScheduledStartTime = ee.ScheduledStartTime,
Tags = ee.Tags,
};
ed.Add(creationMessage.OrchestrationInstance.ExecutionId, newState);
this.orchestratorQueue.SendMessage(creationMessage);
}
return Task.FromResult<object>(null);
}
/// <inheritdoc />
public Task SendTaskOrchestrationMessageAsync(TaskMessage message)
{
return SendTaskOrchestrationMessageBatchAsync(message);
}
/// <inheritdoc />
public Task SendTaskOrchestrationMessageBatchAsync(params TaskMessage[] messages)
{
foreach (TaskMessage message in messages)
{
this.orchestratorQueue.SendMessage(message);
}
return Task.FromResult<object>(null);
}
/// <inheritdoc />
public async Task<OrchestrationState> WaitForOrchestrationAsync(
string instanceId,
string executionId,
TimeSpan timeout,
CancellationToken cancellationToken)
{
if (string.IsNullOrWhiteSpace(executionId))
{
executionId = string.Empty;
}
string key = instanceId + "_" + executionId;
if (!this.orchestrationWaiters.TryGetValue(key, out TaskCompletionSource<OrchestrationState> tcs))
{
tcs = new TaskCompletionSource<OrchestrationState>();
if (!this.orchestrationWaiters.TryAdd(key, tcs))
{
this.orchestrationWaiters.TryGetValue(key, out tcs);
}
if (tcs == null)
{
throw new InvalidOperationException("Unable to get tcs from orchestrationWaiters");
}
}
// might have finished already
lock (this.thisLock)
{
if (this.instanceStore.ContainsKey(instanceId))
{
Dictionary<string, OrchestrationState> stateMap = this.instanceStore[instanceId];
if (stateMap != null && stateMap.Count > 0)
{
OrchestrationState state = null;
if (string.IsNullOrWhiteSpace(executionId))
{
IOrderedEnumerable<OrchestrationState> sortedStateMap = stateMap.Values.OrderByDescending(os => os.CreatedTime);
state = sortedStateMap.First();
}
else
{
if (stateMap.ContainsKey(executionId))
{
state = this.instanceStore[instanceId][executionId];
}
}
if (state != null
&& state.OrchestrationStatus != OrchestrationStatus.Running
&& state.OrchestrationStatus != OrchestrationStatus.Pending)
{
// if only master id was specified then continueAsNew is a not a terminal state
if (!(string.IsNullOrWhiteSpace(executionId) && state.OrchestrationStatus == OrchestrationStatus.ContinuedAsNew))
{
tcs.TrySetResult(state);
}
}
}
}
}
CancellationTokenSource cts = CancellationTokenSource.CreateLinkedTokenSource(
cancellationToken,
this.cancellationTokenSource.Token);
Task timeOutTask = Task.Delay(timeout, cts.Token);
Task ret = await Task.WhenAny(tcs.Task, timeOutTask);
if (ret == timeOutTask)
{
throw new TimeoutException("timed out or canceled while waiting for orchestration to complete");
}
cts.Cancel();
return await tcs.Task;
}
/// <inheritdoc />
public async Task<OrchestrationState> GetOrchestrationStateAsync(string instanceId, string executionId)
{
OrchestrationState response;
lock (this.thisLock)
{
if (!(this.instanceStore.TryGetValue(instanceId, out Dictionary<string, OrchestrationState> state) &&
state.TryGetValue(executionId, out response)))
{
response = null;
}
}
return await Task.FromResult(response);
}
/// <inheritdoc />
public async Task<IList<OrchestrationState>> GetOrchestrationStateAsync(string instanceId, bool allExecutions)
{
IList<OrchestrationState> response;
lock (this.thisLock)
{
if (this.instanceStore.TryGetValue(instanceId, out Dictionary<string, OrchestrationState> state))
{
response = state.Values.ToList();
}
else
{
response = new List<OrchestrationState>();
}
}
return await Task.FromResult(response);
}
/// <inheritdoc />
public Task<string> GetOrchestrationHistoryAsync(string instanceId, string executionId)
{
throw new NotSupportedException();
}
/// <inheritdoc />
public Task PurgeOrchestrationHistoryAsync(DateTime thresholdDateTimeUtc, OrchestrationStateTimeRangeFilterType timeRangeFilterType)
{
throw new NotSupportedException();
}
/******************************/
// Task orchestration methods
/******************************/
/// <inheritdoc />
public int MaxConcurrentTaskOrchestrationWorkItems => this.MaxConcurrentWorkItems;
/// <inheritdoc />
public async Task<TaskOrchestrationWorkItem> LockNextTaskOrchestrationWorkItemAsync(
TimeSpan receiveTimeout,
CancellationToken cancellationToken)
{
TaskSession taskSession = await this.orchestratorQueue.AcceptSessionAsync(receiveTimeout,
CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, this.cancellationTokenSource.Token).Token);
if (taskSession == null)
{
return null;
}
var wi = new TaskOrchestrationWorkItem
{
NewMessages = taskSession.Messages.ToList(),
InstanceId = taskSession.Id,
LockedUntilUtc = DateTime.UtcNow.AddMinutes(5),
OrchestrationRuntimeState =
DeserializeOrchestrationRuntimeState(taskSession.SessionState) ??
new OrchestrationRuntimeState(),
};
return wi;
}
/// <inheritdoc />
public Task CompleteTaskOrchestrationWorkItemAsync(
TaskOrchestrationWorkItem workItem,
OrchestrationRuntimeState newOrchestrationRuntimeState,
IList<TaskMessage> outboundMessages,
IList<TaskMessage> orchestratorMessages,
IList<TaskMessage> workItemTimerMessages,
TaskMessage continuedAsNewMessage,
OrchestrationState state)
{
lock (this.thisLock)
{
byte[] newSessionState;
if (newOrchestrationRuntimeState == null ||
newOrchestrationRuntimeState.ExecutionStartedEvent == null ||
newOrchestrationRuntimeState.OrchestrationStatus != OrchestrationStatus.Running)
{
newSessionState = null;
}
else
{
newSessionState = SerializeOrchestrationRuntimeState(newOrchestrationRuntimeState);
}
this.orchestratorQueue.CompleteSession(
workItem.InstanceId,
newSessionState,
orchestratorMessages,
continuedAsNewMessage
);
if (outboundMessages != null)
{
foreach (TaskMessage m in outboundMessages)
{
// TODO : make async (AFFANDAR)
this.workerQueue.SendMessageAsync(m);
}
}
if (workItemTimerMessages != null)
{
lock (this.timerLock)
{
foreach (TaskMessage m in workItemTimerMessages)
{
this.timerMessages.Add(m);
}
}
}
if (workItem.OrchestrationRuntimeState != newOrchestrationRuntimeState)
{
var oldState = Utils.BuildOrchestrationState(workItem.OrchestrationRuntimeState);
CommitState(workItem.OrchestrationRuntimeState, oldState).GetAwaiter().GetResult();
}
if (state != null)
{
CommitState(newOrchestrationRuntimeState, state).GetAwaiter().GetResult();
}
}
return Task.FromResult(0);
}
Task CommitState(OrchestrationRuntimeState runtimeState, OrchestrationState state)
{
if (!this.instanceStore.TryGetValue(runtimeState.OrchestrationInstance.InstanceId, out Dictionary<string, OrchestrationState> mapState))
{
mapState = new Dictionary<string, OrchestrationState>();
this.instanceStore[runtimeState.OrchestrationInstance.InstanceId] = mapState;
}
mapState[runtimeState.OrchestrationInstance.ExecutionId] = state;
// signal any waiters waiting on instanceid_executionid or just the latest instanceid_
if (state.OrchestrationStatus == OrchestrationStatus.Running
|| state.OrchestrationStatus == OrchestrationStatus.Pending)
{
return Task.FromResult(0);
}
string key = runtimeState.OrchestrationInstance.InstanceId + "_" +
runtimeState.OrchestrationInstance.ExecutionId;
string key1 = runtimeState.OrchestrationInstance.InstanceId + "_";
var tasks = new List<Task>();
if (this.orchestrationWaiters.TryGetValue(key, out TaskCompletionSource<OrchestrationState> tcs))
{
tasks.Add(Task.Run(() => tcs.TrySetResult(state)));
}
// for instance id level waiters, we will not consider ContinueAsNew as a terminal state because
// the high level orchestration is still ongoing
if (state.OrchestrationStatus != OrchestrationStatus.ContinuedAsNew
&& this.orchestrationWaiters.TryGetValue(key1, out TaskCompletionSource<OrchestrationState> tcs1))
{
tasks.Add(Task.Run(() => tcs1.TrySetResult(state)));
}
if (tasks.Count > 0)
{
Task.WaitAll(tasks.ToArray());
}
return Task.FromResult(0);
}
/// <inheritdoc />
public Task AbandonTaskOrchestrationWorkItemAsync(TaskOrchestrationWorkItem workItem)
{
this.orchestratorQueue.AbandonSession(workItem.InstanceId);
return Task.FromResult<object>(null);
}
/// <inheritdoc />
public Task ReleaseTaskOrchestrationWorkItemAsync(TaskOrchestrationWorkItem workItem)
{
return Task.FromResult<object>(null);
}
/// <inheritdoc />
public int TaskActivityDispatcherCount => 1;
/// <summary>
/// Should we carry over unexecuted raised events to the next iteration of an orchestration on ContinueAsNew
/// </summary>
public BehaviorOnContinueAsNew EventBehaviourForContinueAsNew => BehaviorOnContinueAsNew.Carryover;
/// <inheritdoc />
public int MaxConcurrentTaskActivityWorkItems => this.MaxConcurrentWorkItems;
/// <inheritdoc />
public async Task ForceTerminateTaskOrchestrationAsync(string instanceId, string message)
{
var taskMessage = new TaskMessage
{
OrchestrationInstance = new OrchestrationInstance { InstanceId = instanceId },
Event = new ExecutionTerminatedEvent(-1, message)
};
await SendTaskOrchestrationMessageAsync(taskMessage);
}
/// <inheritdoc />
public Task RenewTaskOrchestrationWorkItemLockAsync(TaskOrchestrationWorkItem workItem)
{
workItem.LockedUntilUtc = workItem.LockedUntilUtc.AddMinutes(5);
return Task.FromResult(0);
}
/// <inheritdoc />
public bool IsMaxMessageCountExceeded(int currentMessageCount, OrchestrationRuntimeState runtimeState)
{
return false;
}
/// <inheritdoc />
public int GetDelayInSecondsAfterOnProcessException(Exception exception)
{
return 0;
}
/// <inheritdoc />
public int GetDelayInSecondsAfterOnFetchException(Exception exception)
{
return 0;
}
/// <inheritdoc />
public int TaskOrchestrationDispatcherCount => 1;
/******************************/
// Task activity methods
/******************************/
/// <inheritdoc />
public async Task<TaskActivityWorkItem> LockNextTaskActivityWorkItem(TimeSpan receiveTimeout, CancellationToken cancellationToken)
{
TaskMessage taskMessage = await this.workerQueue.ReceiveMessageAsync(receiveTimeout,
CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, this.cancellationTokenSource.Token).Token);
if (taskMessage == null)
{
return null;
}
return new TaskActivityWorkItem
{
// for the in memory provider we will just use the TaskMessage object ref itself as the id
Id = "N/A",
LockedUntilUtc = DateTime.UtcNow.AddMinutes(5),
TaskMessage = taskMessage,
};
}
/// <inheritdoc />
public Task AbandonTaskActivityWorkItemAsync(TaskActivityWorkItem workItem)
{
this.workerQueue.AbandonMessageAsync(workItem.TaskMessage);
return Task.FromResult<object>(null);
}
/// <inheritdoc />
public Task CompleteTaskActivityWorkItemAsync(TaskActivityWorkItem workItem, TaskMessage responseMessage)
{
lock (this.thisLock)
{
this.workerQueue.CompleteMessageAsync(workItem.TaskMessage);
this.orchestratorQueue.SendMessage(responseMessage);
}
return Task.FromResult<object>(null);
}
/// <inheritdoc />
public Task<TaskActivityWorkItem> RenewTaskActivityWorkItemLockAsync(TaskActivityWorkItem workItem)
{
// TODO : add expiration if we want to unit test it (AFFANDAR)
workItem.LockedUntilUtc = workItem.LockedUntilUtc.AddMinutes(5);
return Task.FromResult(workItem);
}
byte[] SerializeOrchestrationRuntimeState(OrchestrationRuntimeState runtimeState)
{
if (runtimeState == null)
{
return null;
}
string serializeState = JsonConvert.SerializeObject(runtimeState.Events, StateJsonSettings);
return Encoding.UTF8.GetBytes(serializeState);
}
OrchestrationRuntimeState DeserializeOrchestrationRuntimeState(byte[] stateBytes)
{
if (stateBytes == null || stateBytes.Length == 0)
{
return null;
}
string serializedState = Encoding.UTF8.GetString(stateBytes);
var events = JsonConvert.DeserializeObject<IList<HistoryEvent>>(serializedState, StateJsonSettings);
return new OrchestrationRuntimeState(events);
}
/// <inheritdoc />
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
void Dispose(bool disposing)
{
if (disposing)
{
this.cancellationTokenSource.Cancel();
this.cancellationTokenSource.Dispose();
}
}
/// <inheritdoc />
/// Test only for core entities. The value is set as default.
EntityBackendProperties IEntityOrchestrationService.EntityBackendProperties => new EntityBackendProperties()
{
EntityMessageReorderWindow = TimeSpan.FromMinutes(30),
MaxEntityOperationBatchSize = null,
MaxConcurrentTaskEntityWorkItems = 100,
SupportsImplicitEntityDeletion = false, // not supported by this backend
MaximumSignalDelayTime = TimeSpan.FromDays(6),
UseSeparateQueueForEntityWorkItems = false,
};
/// <inheritdoc />
EntityBackendQueries IEntityOrchestrationService.EntityBackendQueries => null;
/// <inheritdoc />
Task<TaskOrchestrationWorkItem> IEntityOrchestrationService.LockNextEntityWorkItemAsync(
TimeSpan receiveTimeout,
CancellationToken cancellationToken)
{
return this.LockNextTaskOrchestrationWorkItemAsync(receiveTimeout, cancellationToken);
}
/// <inheritdoc />
Task<TaskOrchestrationWorkItem> IEntityOrchestrationService.LockNextOrchestrationWorkItemAsync(
TimeSpan receiveTimeout,
CancellationToken cancellationToken)
{
return this.LockNextTaskOrchestrationWorkItemAsync(receiveTimeout, cancellationToken);
}
}
}