KSqlDBContextOptions created with a constructor or by KSqlDbContextOptionsBuilder are setting the auto.offset.reset policy to earliest by default. (Kafka.DotNet.ksqlDB nuget package version: <=1.9.0)
var ksqlDbUrl = @"http:\\localhost:8088";
var contextOptions = new KSqlDbContextOptionsBuilder()
.UseKSqlDb(ksqlDbUrl)
.Options;
//or
contextOptions = new KSqlDBContextOptions(ksqlDbUrl);
Expected behavior
The default auto.offset.reset should be the same as is in ksqldb.
This will be a breaking change. In order to get the previous behavior, use the following config:
var contextOptions = new KSqlDbContextOptionsBuilder()
.UseKSqlDb(ksqlDbUrl)
.SetAutoOffsetReset(AutoOffsetReset.Earliest)
.Options;
Subscriptions to KTables shouldn't be affected by this change. Based on testing it changes only the behavior of subscriptions to KStreams:
await using var context = new KSqlDBContext(contextOptions);
var subscription = context.CreateQueryStream<Movie>()
.Subscribe(onNext: movie =>
{
Console.WriteLine($"{nameof(Movie)}: {movie.Id} - {movie.Title} - {movie.RowTime}");
Console.WriteLine();
}, onError: error => { Console.WriteLine($"Exception: {error.Message}"); }, onCompleted: () => Console.WriteLine("Completed"));
KSqlDbContextOptions should not be opinionated.
KSqlDBContextOptions created with a constructor or by KSqlDbContextOptionsBuilder are setting the auto.offset.reset policy to earliest by default. (Kafka.DotNet.ksqlDB nuget package version: <=1.9.0)
Expected behavior The default auto.offset.reset should be the same as is in ksqldb.
This will be a breaking change. In order to get the previous behavior, use the following config:
Subscriptions to KTables shouldn't be affected by this change. Based on testing it changes only the behavior of subscriptions to KStreams:
Environment:
Context: ksqlstreamsautooffsetreset configuration parameter