Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(consumer): add offset as projection state to read consumer #406

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ nuget Be.Vlaanderen.Basisregisters.GrAr.Provenance 21.14.0
nuget Be.Vlaanderen.Basisregisters.GrAr.Provenance.AcmIdm 21.14.0
nuget Be.Vlaanderen.Basisregisters.GrAr.Extracts 21.14.0

nuget Be.Vlaanderen.Basisregisters.MessageHandling.AwsSqs.Simple 5.0.1
nuget Be.Vlaanderen.Basisregisters.MessageHandling.Kafka.Consumer 5.0.1
nuget Be.Vlaanderen.Basisregisters.MessageHandling.Kafka.Consumer.SqlServer 5.0.1
nuget Be.Vlaanderen.Basisregisters.MessageHandling.Kafka.Producer 5.0.1
nuget Be.Vlaanderen.Basisregisters.MessageHandling.Kafka.Simple 5.0.1
nuget Be.Vlaanderen.Basisregisters.MessageHandling.AwsSqs.Simple 5.1.0
nuget Be.Vlaanderen.Basisregisters.MessageHandling.Kafka.Consumer 5.1.0
nuget Be.Vlaanderen.Basisregisters.MessageHandling.Kafka.Consumer.SqlServer 5.1.0
nuget Be.Vlaanderen.Basisregisters.MessageHandling.Kafka.Producer 5.1.0
nuget Be.Vlaanderen.Basisregisters.MessageHandling.Kafka.Simple 5.1.0

nuget Be.Vlaanderen.Basisregisters.Shaperon 10.0.2

Expand Down
10 changes: 5 additions & 5 deletions paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -296,24 +296,24 @@ NUGET
Be.Vlaanderen.Basisregisters.GrAr.Common (21.14)
Be.Vlaanderen.Basisregisters.GrAr.Provenance (21.14)
Microsoft.CSharp (>= 4.7)
Be.Vlaanderen.Basisregisters.MessageHandling.AwsSqs.Simple (5.0.1)
Be.Vlaanderen.Basisregisters.MessageHandling.AwsSqs.Simple (5.1)
AWSSDK.Core (>= 3.7.302.15)
AWSSDK.SQS (>= 3.7.300.54)
Microsoft.Extensions.Logging (>= 8.0)
Be.Vlaanderen.Basisregisters.MessageHandling.Kafka.Consumer (5.0.1)
Be.Vlaanderen.Basisregisters.MessageHandling.Kafka.Consumer (5.1)
Confluent.Kafka (>= 2.3)
Microsoft.EntityFrameworkCore (>= 8.0.2)
Microsoft.Extensions.Logging (>= 8.0)
Newtonsoft.Json (>= 13.0.3)
Be.Vlaanderen.Basisregisters.MessageHandling.Kafka.Consumer.SqlServer (5.0.1)
Be.Vlaanderen.Basisregisters.MessageHandling.Kafka.Consumer.SqlServer (5.1)
Confluent.Kafka (>= 2.3)
Microsoft.EntityFrameworkCore.SqlServer (>= 8.0.2)
Microsoft.Extensions.Logging (>= 8.0)
Newtonsoft.Json (>= 13.0.3)
Be.Vlaanderen.Basisregisters.MessageHandling.Kafka.Producer (5.0.1)
Be.Vlaanderen.Basisregisters.MessageHandling.Kafka.Producer (5.1)
Confluent.Kafka (>= 2.3)
Newtonsoft.Json (>= 13.0.3)
Be.Vlaanderen.Basisregisters.MessageHandling.Kafka.Simple (5.0.1)
Be.Vlaanderen.Basisregisters.MessageHandling.Kafka.Simple (5.1)
Confluent.Kafka (>= 2.3)
Microsoft.Extensions.Logging (>= 8.0)
Be.Vlaanderen.Basisregisters.Middleware.AddProblemJsonHeader (3.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)

try
{
await _consumer.ConsumeContinuously(async message =>
await _consumer.ConsumeContinuously(async (message, messageContext) =>
{
_logger.LogInformation("Handling next message");

await using var context = await _consumerPostalDbContextFactory.CreateDbContextAsync(stoppingToken);
await projector.ProjectAsync(context, message, stoppingToken).ConfigureAwait(false);

//CancellationToken.None to prevent halfway consumption
await context.UpdateProjectionState(typeof(ConsumerPostal).FullName, messageContext.Offset, stoppingToken);
await context.SaveChangesAsync(CancellationToken.None);

}, stoppingToken);
Expand Down
Loading