confluentinc / confluent-kafka-dotnet

Confluent's Apache Kafka .NET client
https://github.com/confluentinc/confluent-kafka-dotnet/wiki
Apache License 2.0
90 stars 868 forks source link

How to specify key and value types / serdes using IoC #740

Open mhowlett opened 5 years ago

mhowlett commented 5 years ago

[question asked via an another channel]

Is there way to use data contract object as T like

using (var producer = new Producer<string, T>(producerConfig, serdeProvider.GetSerializerGenerator<string>(), serdeProvider.GetSerializerGenerator<T>()))
consumer 
using (var consumer = new Consumer<string, T>(consumerConfig, serdeProvider.GetDeserializerGenerator<string>(), serdeProvider.GetDeserializerGenerator<T>()))

then solve it using IOC container?

mhowlett commented 5 years ago

not via the library itself. you'd need to write a wrapper class, but that wouldn't be too hard. we should do an example of this.

marked as an enhancement as a reminder to add an example. At this point, we don't intend to add this functionality to the core library.

mrkannan3 commented 5 years ago

@mhowlett Thanks for your response. Please post the sample when you can.