|
25 | 25 |
|
26 | 26 | // Enable scheduled tasks support |
27 | 27 | builder.UseDurableTaskScheduler(connectionString); |
28 | | - builder.EnableScheduledTasksSupport(); |
| 28 | + builder.UseScheduledTasks(); |
29 | 29 | }); |
30 | 30 |
|
31 | 31 | // Configure the client |
32 | 32 | services.AddDurableTaskClient(builder => |
33 | 33 | { |
34 | 34 | builder.UseDurableTaskScheduler(connectionString); |
35 | | - builder.EnableScheduledTasksSupport(); |
| 35 | + builder.UseScheduledTasks(); |
36 | 36 | }); |
37 | 37 |
|
38 | 38 | // Configure console logging |
|
62 | 62 | AsyncPageable<string> schedules = await scheduledTaskClient.ListScheduleIdsAsync(query); |
63 | 63 |
|
64 | 64 | // Initialize the continuation token |
65 | | - string? continuationToken = null; |
66 | | - await foreach (Page<string> page in schedules.AsPages(continuationToken)) |
| 65 | + await foreach (string scheduleId in schedules) |
67 | 66 | { |
68 | | - foreach (string scheduleId in page.Values) |
69 | | - { |
70 | | - // Obtain the schedule handle for the current scheduleId |
71 | | - IScheduleHandle handle = scheduledTaskClient.GetScheduleHandle(scheduleId); |
72 | | - |
73 | | - // Delete the schedule |
74 | | - await handle.DeleteAsync(); |
| 67 | + // Obtain the schedule handle for the current scheduleId |
| 68 | + IScheduleHandle handle = scheduledTaskClient.GetScheduleHandle(scheduleId); |
75 | 69 |
|
76 | | - Console.WriteLine($"Deleted schedule {scheduleId}"); |
77 | | - } |
| 70 | + // Delete the schedule |
| 71 | + await handle.DeleteAsync(); |
78 | 72 |
|
79 | | - // Update the continuation token for the next iteration |
80 | | - continuationToken = page.ContinuationToken; |
81 | | - |
82 | | - // If there's no continuation token, we've reached the end of the collection |
83 | | - if (continuationToken == null) |
84 | | - { |
85 | | - break; |
86 | | - } |
| 73 | + Console.WriteLine($"Deleted schedule {scheduleId}"); |
87 | 74 | } |
88 | 75 |
|
89 | 76 |
|
|
101 | 88 | ScheduleDescription scheduleDescription = await scheduleHandle.DescribeAsync(); |
102 | 89 |
|
103 | 90 | // print the schedule description |
104 | | - Console.WriteLine(scheduleDescription.ToJsonString(true)); |
| 91 | + Console.WriteLine(scheduleDescription); |
105 | 92 |
|
106 | 93 | Console.WriteLine(""); |
107 | 94 | Console.WriteLine(""); |
|
111 | 98 | Console.WriteLine("\nPausing schedule..."); |
112 | 99 | await scheduleHandle.PauseAsync(); |
113 | 100 | scheduleDescription = await scheduleHandle.DescribeAsync(); |
114 | | - Console.WriteLine(scheduleDescription.ToJsonString(true)); |
| 101 | + Console.WriteLine(scheduleDescription); |
115 | 102 | Console.WriteLine(""); |
116 | 103 | Console.WriteLine(""); |
117 | 104 | Console.WriteLine(""); |
|
121 | 108 | Console.WriteLine("\nResuming schedule..."); |
122 | 109 | await scheduleHandle.ResumeAsync(); |
123 | 110 | scheduleDescription = await scheduleHandle.DescribeAsync(); |
124 | | - Console.WriteLine(scheduleDescription.ToJsonString(true)); |
| 111 | + Console.WriteLine(scheduleDescription); |
125 | 112 |
|
126 | 113 | Console.WriteLine(""); |
127 | 114 | Console.WriteLine(""); |
128 | 115 | Console.WriteLine(""); |
129 | 116 |
|
130 | 117 | await Task.Delay(TimeSpan.FromMinutes(30)); |
131 | | - //Console.WriteLine("\nPress any key to delete the schedule and exit..."); |
132 | | - //Console.ReadKey(); |
133 | 118 | } |
134 | 119 | catch (Exception ex) |
135 | 120 | { |
|
0 commit comments