mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-15 17:00:03 +08:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
076039abc7 | ||
|
|
61cbaa06a8 | ||
|
|
1114fa041d |
@@ -33,6 +33,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MQTTnet.Extensions.TopicTem
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MQTTnet.Server", "Source\MQTTnet.Server\MQTTnet.Server.csproj", "{C876EFFD-C5AD-4E26-BD9F-4C48252C02BC}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MQTTnet.PowerShell", "Source\MQTTnet.PowerShell\MQTTnet.PowerShell.csproj", "{37B129C5-0231-4EB5-AF13-77959068911C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -79,6 +81,10 @@ Global
|
||||
{C876EFFD-C5AD-4E26-BD9F-4C48252C02BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C876EFFD-C5AD-4E26-BD9F-4C48252C02BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C876EFFD-C5AD-4E26-BD9F-4C48252C02BC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{37B129C5-0231-4EB5-AF13-77959068911C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{37B129C5-0231-4EB5-AF13-77959068911C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{37B129C5-0231-4EB5-AF13-77959068911C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{37B129C5-0231-4EB5-AF13-77959068911C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
using System.Management.Automation;
|
||||
|
||||
namespace MQTTnet.PowerShell.Cmdlets;
|
||||
|
||||
[Cmdlet(VerbsCommunications.Connect, "MqttSession")]
|
||||
[OutputType(typeof(MqttClientConnectResult))]
|
||||
public class ConnectMqttSessionCmdlet : PSCmdlet
|
||||
{
|
||||
[Parameter]
|
||||
public SwitchParameter CleanSession { get; set; } = true;
|
||||
|
||||
[Parameter]
|
||||
public string? ClientId { get; set; } = Guid.NewGuid().ToString();
|
||||
|
||||
[Parameter(Mandatory = true)]
|
||||
public required new string Host { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string? Password { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public int Port { get; set; } = 1883;
|
||||
|
||||
[Parameter(Mandatory = true, ValueFromPipeline = true)]
|
||||
public required PsMqttSession Session { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string? Username { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public SwitchParameter UseTls { get; set; }
|
||||
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
var clientOptionsBuilder = new MqttClientOptionsBuilder();
|
||||
clientOptionsBuilder.WithTcpServer(Host, Port);
|
||||
|
||||
if (Username != null)
|
||||
{
|
||||
clientOptionsBuilder.WithCredentials(Username, Password);
|
||||
}
|
||||
|
||||
var response = Session.GetClient().ConnectAsync(clientOptionsBuilder.Build()).GetAwaiter().GetResult();
|
||||
|
||||
WriteObject(response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System.Management.Automation;
|
||||
|
||||
namespace MQTTnet.PowerShell.Cmdlets;
|
||||
|
||||
[Cmdlet(VerbsCommunications.Disconnect, "MqttSession")]
|
||||
public class DisconnectMqttSessionCmdlet : PSCmdlet
|
||||
{
|
||||
[Parameter]
|
||||
public MqttClientDisconnectOptionsReason Reason { get; set; } = MqttClientDisconnectOptionsReason.NormalDisconnection;
|
||||
|
||||
[Parameter]
|
||||
public string? ReasonString { get; set; }
|
||||
|
||||
[Parameter(Mandatory = true, ValueFromPipeline = true)]
|
||||
public required PsMqttSession Session { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public uint SessionExpiryInterval { get; set; }
|
||||
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
if (Session.GetClient().IsConnected)
|
||||
{
|
||||
var options = new MqttClientDisconnectOptionsBuilder().WithSessionExpiryInterval(SessionExpiryInterval).WithReason(Reason).WithReasonString(ReasonString).Build();
|
||||
|
||||
Session.GetClient().DisconnectAsync(options).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
WriteObject("Disconnected.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System.Management.Automation;
|
||||
|
||||
namespace MQTTnet.PowerShell.Cmdlets;
|
||||
|
||||
[Cmdlet(VerbsCommon.New, "MqttSession")]
|
||||
[OutputType(typeof(PsMqttSession))]
|
||||
public class NewMqttSessionCmdlet : PSCmdlet
|
||||
{
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
WriteObject(new PsMqttSession());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
using System.Management.Automation;
|
||||
using System.Text;
|
||||
using MQTTnet.Protocol;
|
||||
|
||||
namespace MQTTnet.PowerShell.Cmdlets;
|
||||
|
||||
[Cmdlet(VerbsData.Publish, "MqttMessage")]
|
||||
public class PublishMqttMessageCmdlet : PSCmdlet
|
||||
{
|
||||
[Parameter(Mandatory = true)]
|
||||
public string? Payload { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public int QoS { get; set; } = 0;
|
||||
|
||||
[Parameter]
|
||||
public SwitchParameter Retain { get; set; }
|
||||
|
||||
[Parameter(Mandatory = true, ValueFromPipeline = true)]
|
||||
public required PsMqttSession Session { get; set; }
|
||||
|
||||
[Parameter(Mandatory = true)]
|
||||
public required string Topic { get; set; }
|
||||
|
||||
public string? ContentType { get; set; }
|
||||
|
||||
public string? ResponseTopic { get; set; }
|
||||
|
||||
public ushort TopicAlias { get; set; }
|
||||
|
||||
public uint MessageExpiryInterval { get; set; }
|
||||
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
// if (Session == null || !Session.IsConnected)
|
||||
// throw new InvalidOperationException("Session not connected.");
|
||||
|
||||
var msg = new MqttApplicationMessageBuilder().WithTopic(Topic)
|
||||
.WithPayload(Encoding.UTF8.GetBytes(Payload ?? string.Empty))
|
||||
.WithQualityOfServiceLevel((MqttQualityOfServiceLevel)QoS)
|
||||
.WithRetainFlag(Retain)
|
||||
.WithContentType(ContentType)
|
||||
.WithResponseTopic(ResponseTopic)
|
||||
.WithTopicAlias(TopicAlias)
|
||||
.WithMessageExpiryInterval(MessageExpiryInterval)
|
||||
.Build();
|
||||
|
||||
var response = Session.GetClient().PublishAsync(msg).GetAwaiter().GetResult();
|
||||
|
||||
WriteObject(response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Management.Automation;
|
||||
|
||||
namespace MQTTnet.PowerShell.Cmdlets;
|
||||
|
||||
[Cmdlet(VerbsCommunications.Receive, "MqttMessage")]
|
||||
[OutputType(typeof(PsMqttMessage))]
|
||||
public class ReceiveMqttMessageCmdlet : PSCmdlet
|
||||
{
|
||||
[Parameter(Mandatory = true, ValueFromPipeline = true)]
|
||||
public required PsMqttSession Session { get; set; }
|
||||
|
||||
[Parameter]
|
||||
[ValidateRange(0, int.MaxValue)]
|
||||
public int TimeoutSeconds { get; set; } = 0;
|
||||
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
var tcs = new TaskCompletionSource<PsMqttMessage>();
|
||||
EventHandler<PsMqttMessage>? handler = null;
|
||||
CancellationTokenSource? cts = null;
|
||||
|
||||
try
|
||||
{
|
||||
handler = (s, e) =>
|
||||
{
|
||||
if (!tcs.Task.IsCompleted)
|
||||
{
|
||||
tcs.TrySetResult(e);
|
||||
}
|
||||
};
|
||||
|
||||
Session.MessageReceived += handler;
|
||||
|
||||
// Optionaler Timeout
|
||||
if (TimeoutSeconds > 0)
|
||||
{
|
||||
cts = new CancellationTokenSource();
|
||||
cts.CancelAfter(TimeSpan.FromSeconds(TimeoutSeconds));
|
||||
cts.Token.Register(() =>
|
||||
{
|
||||
if (!tcs.Task.IsCompleted)
|
||||
{
|
||||
tcs.TrySetCanceled();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
WriteVerbose("Waiting for next MQTT message...");
|
||||
|
||||
try
|
||||
{
|
||||
var message = tcs.Task.GetAwaiter().GetResult();
|
||||
WriteObject(message);
|
||||
}
|
||||
catch (TaskCanceledException)
|
||||
{
|
||||
WriteWarning($"Timeout after {TimeoutSeconds} seconds — no message received.");
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (handler != null)
|
||||
{
|
||||
Session.MessageReceived -= handler;
|
||||
}
|
||||
|
||||
cts?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System.Management.Automation;
|
||||
using System.Management.Automation.Runspaces;
|
||||
|
||||
namespace MQTTnet.PowerShell.Cmdlets;
|
||||
|
||||
[Cmdlet(VerbsLifecycle.Register, "MqttMessageHandler")]
|
||||
public class RegisterMqttMessageHandlerCmdlet : PSCmdlet
|
||||
{
|
||||
[Parameter(Mandatory = true, ValueFromPipeline = true)]
|
||||
public required PsMqttSession Session { get; set; }
|
||||
|
||||
[Parameter(Mandatory = true)]
|
||||
public ScriptBlock? Action { get; set; }
|
||||
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
EventHandler<PsMqttMessage> handler = (s, e) =>
|
||||
{
|
||||
//throw new NotImplementedException();
|
||||
//InvokeCommand.InvokeScript(Action, false, PipelineResultTypes.Output, null, new object[] { e.Topic, e.Payload });
|
||||
};
|
||||
|
||||
Session.MessageReceived += handler;
|
||||
WriteObject($"Handler registered for MQTT messages on session.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System.Management.Automation;
|
||||
|
||||
namespace MQTTnet.PowerShell.Cmdlets;
|
||||
|
||||
[Cmdlet(VerbsCommon.Remove, "MqttSession")]
|
||||
public class RemoveMqttSessionCmdlet : PSCmdlet
|
||||
{
|
||||
[Parameter(Mandatory = true, ValueFromPipeline = true)]
|
||||
public required PsMqttSession Session { get; set; }
|
||||
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
Session.Dispose();
|
||||
WriteObject("Session removed.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Management.Automation;
|
||||
using MQTTnet.Protocol;
|
||||
|
||||
namespace MQTTnet.PowerShell.Cmdlets;
|
||||
|
||||
[Cmdlet("Subscribe", "MqttTopic")]
|
||||
[OutputType(typeof(MqttClientSubscribeResult))]
|
||||
public class SubscribeMqttTopicCmdlet : PSCmdlet
|
||||
{
|
||||
[Parameter]
|
||||
public bool NoLocal { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public int QoS { get; set; } = 0;
|
||||
|
||||
[Parameter]
|
||||
public bool RetainAsPublished { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public MqttRetainHandling RetainHandling { get; set; } = MqttRetainHandling.SendAtSubscribe;
|
||||
|
||||
[Parameter(Mandatory = true, ValueFromPipeline = true)]
|
||||
public required PsMqttSession Session { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public uint SubscriptionIdentifier { get; set; }
|
||||
|
||||
[Parameter(Mandatory = true)]
|
||||
public required string Topic { get; set; }
|
||||
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
var topicFilter = new MqttTopicFilterBuilder().WithTopic(Topic)
|
||||
.WithQualityOfServiceLevel((MqttQualityOfServiceLevel)QoS)
|
||||
.WithNoLocal(NoLocal)
|
||||
.WithRetainAsPublished(RetainAsPublished)
|
||||
.WithRetainHandling(RetainHandling)
|
||||
.Build();
|
||||
|
||||
var options = new MqttClientSubscribeOptionsBuilder().WithTopicFilter(topicFilter);
|
||||
|
||||
if (SubscriptionIdentifier > 0)
|
||||
{
|
||||
options.WithSubscriptionIdentifier(SubscriptionIdentifier);
|
||||
}
|
||||
|
||||
var response = Session.GetClient().SubscribeAsync(options.Build()).GetAwaiter().GetResult();
|
||||
|
||||
WriteObject(response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.Management.Automation;
|
||||
|
||||
namespace MQTTnet.PowerShell.Cmdlets;
|
||||
|
||||
[Cmdlet("Unsubscribe", "MqttTopic")]
|
||||
[OutputType(typeof(MqttClientUnsubscribeResult))]
|
||||
public class UnsubscribeMqttTopicCmdlet : PSCmdlet
|
||||
{
|
||||
[Parameter(Mandatory = true, ValueFromPipeline = true)]
|
||||
public required PsMqttSession Session { get; set; }
|
||||
|
||||
[Parameter(Mandatory = true)]
|
||||
public required string Topic { get; set; }
|
||||
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
var options = new MqttClientUnsubscribeOptionsBuilder().WithTopicFilter(Topic).Build();
|
||||
|
||||
var response = Session.GetClient().UnsubscribeAsync(options).GetAwaiter().GetResult();
|
||||
|
||||
WriteObject(response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<AssemblyName>MQTTnet.PowerShell</AssemblyName>
|
||||
<LangVersion>default</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="PowerShellStandard.Library" Version="5.1.1">
|
||||
<PrivateAssets>All</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MQTTnet\MQTTnet.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="bin\Debug\net8.0\MQTTnet.dll" />
|
||||
<Content Include="bin\Debug\net8.0\MQTTnet.pdb" />
|
||||
<Content Include="bin\Debug\net8.0\MQTTnet.PowerShell.deps.json" />
|
||||
<Content Include="bin\Debug\net8.0\MQTTnet.PowerShell.dll" />
|
||||
<Content Include="bin\Debug\net8.0\MQTTnet.PowerShell.pdb" />
|
||||
<Content Include="bin\Debug\net8.0\MQTTnet.xml" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,30 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Management.Automation;
|
||||
using MQTTnet.Packets;
|
||||
|
||||
namespace MQTTnet.PowerShell;
|
||||
|
||||
public class PsMqttPublishResult
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class PsMqttConnectResult
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class PsMqttMessage
|
||||
{
|
||||
public required string? ContentType { get; init; }
|
||||
public required string Payload { get; init; }
|
||||
public int QoS { get; init; }
|
||||
public required byte[] RawPayload { get; init; }
|
||||
public string? ResponseTopic { get; init; }
|
||||
public bool Retain { get; init; }
|
||||
public required string Topic { get; init; }
|
||||
public required List<MqttUserProperty>? UserProperties { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Buffers;
|
||||
using System.Text;
|
||||
|
||||
namespace MQTTnet.PowerShell;
|
||||
|
||||
public sealed class PsMqttSession : IDisposable
|
||||
{
|
||||
readonly IMqttClient _client;
|
||||
|
||||
public PsMqttSession()
|
||||
{
|
||||
var factory = new MqttClientFactory();
|
||||
_client = factory.CreateMqttClient();
|
||||
|
||||
_client.ApplicationMessageReceivedAsync += e =>
|
||||
{
|
||||
MessageReceived?.Invoke(
|
||||
this,
|
||||
new PsMqttMessage
|
||||
{
|
||||
Topic = e.ApplicationMessage.Topic,
|
||||
Payload = Encoding.UTF8.GetString(e.ApplicationMessage.Payload),
|
||||
RawPayload = e.ApplicationMessage.Payload.ToArray(),
|
||||
UserProperties = e.ApplicationMessage.UserProperties,
|
||||
QoS = (int)e.ApplicationMessage.QualityOfServiceLevel,
|
||||
ContentType = e.ApplicationMessage.ContentType,
|
||||
Retain = e.ApplicationMessage.Retain,
|
||||
ResponseTopic = e.ApplicationMessage.ResponseTopic
|
||||
});
|
||||
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
}
|
||||
|
||||
public event EventHandler<PsMqttMessage>? MessageReceived;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_client.Dispose();
|
||||
}
|
||||
|
||||
public IMqttClient GetClient()
|
||||
{
|
||||
return _client;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
Import-Module ./bin/Debug/net8.0/MQTTnet.PowerShell.dll
|
||||
|
||||
$session = New-MqttSession
|
||||
|
||||
Connect-MqttSession -Session $session -Host "192.168.1.16"
|
||||
|
||||
Publish-MqttMessage -Session $session -Topic "Test" -Payload "Hello from PowerShell"
|
||||
|
||||
Subscribe-MqttTopic -Session $session -Topic "test/demo"
|
||||
|
||||
Receive-MqttMessage -Session $session -TimeoutSeconds 200
|
||||
|
||||
Disconnect-MqttSession -Session $session
|
||||
Remove-MqttSession -Session $session
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETCoreApp,Version=v8.0",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v8.0": {
|
||||
"MQTTnet.PowerShell/1.0.0": {
|
||||
"dependencies": {
|
||||
"MQTTnet": "1.0.0",
|
||||
"PowerShellStandard.Library": "5.1.1"
|
||||
},
|
||||
"runtime": {
|
||||
"MQTTnet.PowerShell.dll": {}
|
||||
}
|
||||
},
|
||||
"PowerShellStandard.Library/5.1.1": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/System.Management.Automation.dll": {
|
||||
"assemblyVersion": "3.0.0.0",
|
||||
"fileVersion": "5.1.1.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"MQTTnet/1.0.0": {
|
||||
"runtime": {
|
||||
"MQTTnet.dll": {
|
||||
"assemblyVersion": "1.0.0.0",
|
||||
"fileVersion": "1.0.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"MQTTnet.PowerShell/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
},
|
||||
"PowerShellStandard.Library/5.1.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-e31xJjG+Kjbv6YF3Yq6D4Dl3or8v7LrNF41k3CXrWozW6hR1zcOe5KYuZJaGSiAgLnwP8wcW+I3+IWEzMPZKXQ==",
|
||||
"path": "powershellstandard.library/5.1.1",
|
||||
"hashPath": "powershellstandard.library.5.1.1.nupkg.sha512"
|
||||
},
|
||||
"MQTTnet/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
#if DEBUG
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
@@ -56,7 +57,7 @@ public sealed class Load_Tests : BaseTestClass
|
||||
|
||||
for (var j = 0; j < 1000; j++)
|
||||
{
|
||||
publishPacket.Topic = j.ToString();
|
||||
publishPacket.Topic = j.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
await client.SendAsync(publishPacket, CancellationToken.None);
|
||||
}
|
||||
@@ -143,7 +144,7 @@ public sealed class Load_Tests : BaseTestClass
|
||||
|
||||
for (var j = 0; j < 1000; j++)
|
||||
{
|
||||
var message = applicationMessageBuilder.WithTopic(j.ToString()).Build();
|
||||
var message = applicationMessageBuilder.WithTopic(j.ToString(CultureInfo.InvariantCulture)).Build();
|
||||
|
||||
await client.PublishAsync(message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user