我有以下 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)