升级 Confluent.Kafka 单元测试消息 .NET Core 时出错
Errors upgrading Confluent.Kafka Unit test Messages .NET Core
_failedResult = new Message<string, string>(Consts.Topic, Consts.Partition, Consts.Offset, Consts.Key, It.IsAny<string>(), default(Timestamp), new Error(ErrorCode.Local_MsgTimedOut, MsgTimeoutReason));
我无法升级到最新的 Kafka,因为我的单元测试使用的是旧消息格式。我似乎找不到列出如何正确设置消息格式的文档。任何帮助将不胜感激。
谢谢
您可以在confluent-kafka-dotnet
:
中看到当前稳定v1.3.0
上的消息格式
https://github.com/confluentinc/confluent-kafka-dotnet/blob/v1.3.0/src/Confluent.Kafka/Message.cs
您通过以下方式生产:
var message = new SomeDto();
var dr = await _producer.ProduceAsync(
"topic-name",
new Message<Null, SomeDto>
{
Value = message
},
cancellationToken);
消息中包含的数据,如 Topic
、Partition
不再是消息的一部分(它们是 Producer Config 或 Produce Method 的一部分)
_failedResult = new Message<string, string>(Consts.Topic, Consts.Partition, Consts.Offset, Consts.Key, It.IsAny<string>(), default(Timestamp), new Error(ErrorCode.Local_MsgTimedOut, MsgTimeoutReason));
我无法升级到最新的 Kafka,因为我的单元测试使用的是旧消息格式。我似乎找不到列出如何正确设置消息格式的文档。任何帮助将不胜感激。
谢谢
您可以在confluent-kafka-dotnet
:
v1.3.0
上的消息格式
https://github.com/confluentinc/confluent-kafka-dotnet/blob/v1.3.0/src/Confluent.Kafka/Message.cs
您通过以下方式生产:
var message = new SomeDto();
var dr = await _producer.ProduceAsync(
"topic-name",
new Message<Null, SomeDto>
{
Value = message
},
cancellationToken);
消息中包含的数据,如 Topic
、Partition
不再是消息的一部分(它们是 Producer Config 或 Produce Method 的一部分)