|
22 | 22 | using ksqlDB.RestApi.Client.KSql.Query.Functions;
|
23 | 23 | using ksqlDB.RestApi.Client.KSql.Query.Operators;
|
24 | 24 | using ksqlDB.RestApi.Client.KSql.Query.Options;
|
| 25 | +using ksqlDb.RestApi.Client.KSql.Query.PushQueries; |
25 | 26 | using ksqlDB.RestApi.Client.KSql.Query.Windows;
|
26 | 27 | using ksqlDB.RestApi.Client.KSql.RestApi;
|
27 | 28 | using ksqlDB.RestApi.Client.KSql.RestApi.Extensions;
|
@@ -209,7 +210,7 @@ private static async Task AddAndSaveChangesAsync(KSqlDBContext context)
|
209 | 210 | var saveResponse = await context.SaveChangesAsync();
|
210 | 211 | }
|
211 | 212 |
|
212 |
| - private static async Task SubscribeAsync(IKSqlDBContext context) |
| 213 | + private static async Task SubscribeAsync(IKSqlDBContext context, IKSqlDbRestApiClient restApiProvider) |
213 | 214 | {
|
214 | 215 | var cts = new CancellationTokenSource();
|
215 | 216 |
|
@@ -379,6 +380,8 @@ private static IDisposable FullOuterJoinTables(KSqlDBContext context)
|
379 | 380 |
|
380 | 381 | private static IDisposable Window(KSqlDBContext context)
|
381 | 382 | {
|
| 383 | + new TimeWindows(Duration.OfSeconds(2), OutputRefinement.Final).WithGracePeriod(Duration.OfSeconds(2)); |
| 384 | + |
382 | 385 | var subscription1 = context.CreateQueryStream<Tweet>()
|
383 | 386 | .GroupBy(c => c.Id)
|
384 | 387 | .WindowedBy(new TimeWindows(Duration.OfSeconds(5)).WithGracePeriod(Duration.OfHours(2)))
|
@@ -869,7 +872,17 @@ private static async Task TerminatePersistentQueryAsync(IKSqlDbRestApiClient res
|
869 | 872 |
|
870 | 873 | var query = queries.SelectMany(c => c.Queries).FirstOrDefault(c => c.SinkKafkaTopics.Contains(topicName));
|
871 | 874 |
|
872 |
| - var response = await restApiClient.TerminatePersistentQueryAsync(query.Id); |
| 875 | + if (query == null) |
| 876 | + return; |
| 877 | + |
| 878 | + await TerminatePersistentQueryAsync(restApiClient, query.Id); |
| 879 | + } |
| 880 | + |
| 881 | + private static async Task TerminatePersistentQueryAsync(IKSqlDbRestApiClient restApiClient, string queryId) |
| 882 | + { |
| 883 | + var response = await restApiClient.PausePersistentQueryAsync(queryId); |
| 884 | + response = await restApiClient.ResumePersistentQueryAsync(queryId); |
| 885 | + response = await restApiClient.TerminatePersistentQueryAsync(queryId); |
873 | 886 | }
|
874 | 887 |
|
875 | 888 | private static async Task TerminatePushQueryAsync(IKSqlDBContext context, IKSqlDbRestApiClient restApiClient)
|
|
0 commit comments