Description
This change will allow configuration settings used to initialize instances of ClientConfig, ConsumerConfig and ProducerConfig to be reused for StreamConfig initialization.
Changes
[x] refactor StreamConfig to support proper property initialization through .net options pattern
[x] add unit test
Problem Details
Currently StreamConfig is derived from Dictionary<string, dynamic> thus during the instance initialization the public property setters are ignored, the configuration values are stored directly into the base class (the dictionary) and the type conversion (i.e. for enum values) is not handled properly, i.e. consider the following configuration in appsettings.json file:
when applied through options pattern this configuration won't initialize config.AutoOffsetReset property with Error but just will create the following entry in the underlying dictionary, however such entry has no meaning to StreamConfig at all
{ "AutoOffsetReset", "Error" }
Expected behavior
For expected behavior please follow the implementation of CreateStreamConfigThroughOptionsPattern test from this PR.
Description
This change will allow configuration settings used to initialize instances of
ClientConfig
,ConsumerConfig
andProducerConfig
to be reused forStreamConfig
initialization.Changes
StreamConfig
to support proper property initialization through .net options patternProblem Details Currently
StreamConfig
is derived fromDictionary<string, dynamic>
thus during the instance initialization the public property setters are ignored, the configuration values are stored directly into the base class (the dictionary) and the type conversion (i.e. forenum
values) is not handled properly, i.e. consider the following configuration in appsettings.json file:when applied through options pattern this configuration won't initialize
config.AutoOffsetReset
property withError
but just will create the following entry in the underlying dictionary, however such entry has no meaning toStreamConfig
at allExpected behavior For expected behavior please follow the implementation of
CreateStreamConfigThroughOptionsPattern
test from this PR.