小编Mar*_*bel的帖子

为什么这个测试要花这么长时间?

我有以下 xUnit(版本 2.3.1)测试,用于向 Kafka 发送 100 条消息

[Fact]
public void Test1()
{
    Stopwatch sw = new Stopwatch();

    sw.Start();

    var config = new Dictionary<string, object>
                    {
                        { "group.id", "gid" },
                        { "bootstrap.servers", "localhost" },
                        { "enable.auto.commit", true },
                        { "default.topic.config", new Dictionary<string, object>()
                            {
                                { "message.timeout.ms", 500 }
                            }
                        },
                    };

    var connection = new KafkaConnection(config, new ShreddingQueueCache());

    for (byte i = 0; i < 100; i++)
    {
        connection.Send(new Message(new Guid(1, 2, 3, new byte[] { 0, 1, 0, 1, 0, …
Run Code Online (Sandbox Code Playgroud)

c# xunit .net-core kafka-producer-api confluent-platform

5
推荐指数
0
解决办法
217
查看次数