Skip to content

Commit 5104c53

Browse files
EsonXiexieyidong
andauthored
Kafka if MainConfig is configured, CAP customization will not be set (#1686)
* Fix kafka customize options have been overwirte and set default options when some options never be setted options: queue.buffering.max.messages, message.timeout.ms, request.timeout.ms * simplify the expression --------- Co-authored-by: xieyidong <[email protected]>
1 parent bf7568a commit 5104c53

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/DotNetCore.CAP.Kafka/IConnectionPool.Default.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ public IProducer<string, byte[]> RentProducer()
4141
var config = new ProducerConfig(new Dictionary<string, string>(_options.MainConfig))
4242
{
4343
BootstrapServers = _options.Servers,
44-
QueueBufferingMaxMessages = 10,
45-
MessageTimeoutMs = 5000,
46-
RequestTimeoutMs = 3000
4744
};
4845

46+
config.QueueBufferingMaxMessages ??= 10;
47+
config.MessageTimeoutMs ??= 5000;
48+
config.RequestTimeoutMs ??= 3000;
49+
4950
producer = BuildProducer(config);
5051

5152
return producer;

0 commit comments

Comments
 (0)