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

#385 - Fix EOS duplicate handle - Client is fenced #388

Merged
merged 2 commits into from
Nov 25, 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
2 changes: 1 addition & 1 deletion core/Kafka/Internal/StreamsProducer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public StreamsProducer(
case ProcessingGuarantee.AT_LEAST_ONCE:
break;
case ProcessingGuarantee.EXACTLY_ONCE:
_producerConfig.TransactionalId = $"{config.ApplicationId}-{processId}";
_producerConfig.TransactionalId = $"{config.ApplicationId}-{processId}-{threadId}";
break;
default:
throw new StreamsException($"Guarantee {config.Guarantee} is not supported yet");
Expand Down
9 changes: 5 additions & 4 deletions core/Metrics/Internal/RocksDBMetricsRecordingTrigger.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Streamiz.Kafka.Net.Errors;

namespace Streamiz.Kafka.Net.Metrics.Internal
{
internal class RocksDbMetricsRecordingTrigger
{
private IDictionary<string, RocksDbMetricsRecorder> MetricsRecorders { get; }
= new Dictionary<string, RocksDbMetricsRecorder>();
private ConcurrentDictionary<string, RocksDbMetricsRecorder> MetricsRecorders { get; } = new();

internal void AddMetricsRecorder(RocksDbMetricsRecorder recorder)
{
if (!MetricsRecorders.ContainsKey(recorder.Name))
{
MetricsRecorders.Add(recorder.Name, recorder);
MetricsRecorders.TryAdd(recorder.Name, recorder);
return;
}

Expand All @@ -21,7 +22,7 @@ internal void AddMetricsRecorder(RocksDbMetricsRecorder recorder)
}

internal void RemoveMetricsRecorder(RocksDbMetricsRecorder recorder)
=> MetricsRecorders.Remove(recorder.Name);
=> MetricsRecorders.TryRemove(recorder.Name, out RocksDbMetricsRecorder _);

internal void Run(long now)
{
Expand Down
4 changes: 3 additions & 1 deletion launcher/sample-stream/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ public static async Task Main(string[] args)
ApplicationId = $"test-app",
BootstrapServers = "localhost:9092",
AutoOffsetReset = AutoOffsetReset.Earliest,
Guarantee = ProcessingGuarantee.EXACTLY_ONCE,
Logger = LoggerFactory.Create((b) =>
{
b.AddConsole();
b.SetMinimumLevel(LogLevel.Information);
})
}),
NumStreamThreads = 2
};

var t = BuildTopology();
Expand Down
Loading