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

[Bug Report]: Durable producer use topic name and we cannot have same topic for multiple message #146

Open
1 task done
kYann opened this issue Dec 27, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@kYann
Copy link

kYann commented Dec 27, 2023

Prerequisites

  • I have searched issues to ensure it has not already been reported

Description

Hello,

When creating a durable retry with two different message for the same topic, then the producer creation fail.

Steps to reproduce

  1. Declare consumer with durable retry with same topic but different message type
  2. Start kafkabus

Expected behavior

Should start without issue

Actual behavior

ArgumentException

Message: 
  System.ArgumentException : An item with the same key has already been added. Key: kafka-flow-retry-durable-producer-test-test-message-retry

Stack Trace: 
  Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
  Dictionary`2.Add(TKey key, TValue value)
  Enumerable.ToDictionary[TSource,TKey](IEnumerable`1 source, Func`2 keySelector, IEqualityComparer`1 comparer)
  Enumerable.ToDictionary[TSource,TKey](IEnumerable`1 source, Func`2 keySelector)
  ProducerAccessor.ctor(IEnumerable`1 producers)
  <>c__DisplayClass5_0.<Build>b__1(IDependencyResolver resolver)
  <>c__DisplayClass6_0`1.<Add>b__0(IServiceProvider provider)
  CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)
  CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
  CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context)
  CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
  CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
  ServiceProvider.CreateServiceAccessor(ServiceIdentifier serviceIdentifier)
  ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
  ServiceProvider.GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope)
  ServiceProviderEngineScope.GetService(Type serviceType)
  MicrosoftDependencyResolver.Resolve(Type type)
  DependencyResolverExtensions.Resolve[T](IDependencyResolver resolver)
  KafkaFlowConfigurator.CreateBus(IDependencyResolver resolver)

Producer name should use the message type name. See

var producerName = $"{RetryDurableConstants.EmbeddedProducerName}-{this.retryTopicName}";

KafkaFlow Retry Extensions version

v3.0.0

@kYann kYann added the bug Something isn't working label Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant