mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-19 11:03:07 +08:00
Restore interfaces.
This commit is contained in:
@@ -37,8 +37,8 @@ namespace MQTTnet.Benchmarks
|
||||
CancellationTokenSource _cancellationTokenSource;
|
||||
|
||||
MqttServer _mqttServer;
|
||||
List<MQTTnet.Client.MqttClient> _mqttSubscriberClients;
|
||||
Dictionary<string, MQTTnet.Client.MqttClient> _mqttPublisherClientsByPublisherName;
|
||||
List<IMqttClient> _mqttSubscriberClients;
|
||||
Dictionary<string, IMqttClient> _mqttPublisherClientsByPublisherName;
|
||||
|
||||
Dictionary<string, List<string>> _topicsByPublisher;
|
||||
Dictionary<string, string> _publisherByTopic;
|
||||
@@ -74,7 +74,7 @@ namespace MQTTnet.Benchmarks
|
||||
_mqttServer.StartAsync().GetAwaiter().GetResult();
|
||||
|
||||
// Create publisher clients
|
||||
_mqttPublisherClientsByPublisherName = new Dictionary<string, MQTTnet.Client.MqttClient>();
|
||||
_mqttPublisherClientsByPublisherName = new Dictionary<string, IMqttClient>();
|
||||
foreach (var pt in _topicsByPublisher)
|
||||
{
|
||||
var publisherName = pt.Key;
|
||||
@@ -89,7 +89,7 @@ namespace MQTTnet.Benchmarks
|
||||
}
|
||||
|
||||
// Create subscriber clients
|
||||
_mqttSubscriberClients = new List<MQTTnet.Client.MqttClient>();
|
||||
_mqttSubscriberClients = new List<IMqttClient>();
|
||||
for (var i = 0; i < NumSubscribers; i++)
|
||||
{
|
||||
var mqttSubscriberClient = factory.CreateMqttClient();
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace MQTTnet.Benchmarks
|
||||
public class MessageProcessingBenchmark
|
||||
{
|
||||
MqttServer _mqttServer;
|
||||
MqttClient _mqttClient;
|
||||
IMqttClient _mqttClient;
|
||||
MqttApplicationMessage _message;
|
||||
|
||||
[GlobalSetup]
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace MQTTnet.Benchmarks
|
||||
public class MessageProcessingMqttConnectionContextBenchmark
|
||||
{
|
||||
IWebHost _host;
|
||||
MqttClient _mqttClient;
|
||||
IMqttClient _mqttClient;
|
||||
MqttApplicationMessage _message;
|
||||
|
||||
[GlobalSetup]
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace MQTTnet.Benchmarks
|
||||
public class SubscribeBenchmark
|
||||
{
|
||||
MqttServer _mqttServer;
|
||||
MQTTnet.Client.MqttClient _mqttClient;
|
||||
IMqttClient _mqttClient;
|
||||
|
||||
const int NumPublishers = 1;
|
||||
const int NumTopicsPerPublisher = 10000;
|
||||
@@ -54,6 +54,7 @@ namespace MQTTnet.Benchmarks
|
||||
var subscribeOptions = new MqttClientSubscribeOptionsBuilder()
|
||||
.WithTopicFilter(topic, Protocol.MqttQualityOfServiceLevel.AtMostOnce)
|
||||
.Build();
|
||||
|
||||
_mqttClient.SubscribeAsync(subscribeOptions).GetAwaiter().GetResult();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using BenchmarkDotNet.Jobs;
|
||||
using MQTTnet.Client;
|
||||
using MQTTnet.Server;
|
||||
using System.Collections.Generic;
|
||||
@@ -11,7 +10,7 @@ namespace MQTTnet.Benchmarks
|
||||
public class UnsubscribeBenchmark
|
||||
{
|
||||
MqttServer _mqttServer;
|
||||
MQTTnet.Client.MqttClient _mqttClient;
|
||||
IMqttClient _mqttClient;
|
||||
|
||||
const int NumPublishers = 1;
|
||||
const int NumTopicsPerPublisher = 10000;
|
||||
@@ -40,7 +39,7 @@ namespace MQTTnet.Benchmarks
|
||||
foreach (var topic in _topics)
|
||||
{
|
||||
var subscribeOptions = new MqttClientSubscribeOptionsBuilder()
|
||||
.WithTopicFilter(topic, Protocol.MqttQualityOfServiceLevel.AtMostOnce)
|
||||
.WithTopicFilter(topic)
|
||||
.Build();
|
||||
_mqttClient.SubscribeAsync(subscribeOptions).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user