File tree 2 files changed +12
-5
lines changed
2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ public Task DeleteAsync()
48
48
/// <returns>
49
49
/// A task that represents the asynchronous operation. The result contains the delivered MQTT publish packet.
50
50
/// </returns>
51
- public async Task < MqttPublishPacket > DeliverApplicationMessageAsync ( MqttApplicationMessage applicationMessage )
51
+ public async Task < MqttPacketWithIdentifier > DeliverApplicationMessageAsync ( MqttApplicationMessage applicationMessage )
52
52
{
53
53
ArgumentNullException . ThrowIfNull ( applicationMessage ) ;
54
54
@@ -57,7 +57,7 @@ public async Task<MqttPublishPacket> DeliverApplicationMessageAsync(MqttApplicat
57
57
58
58
var mqttPacket = await packetBusItem . WaitAsync ( ) ;
59
59
60
- return ( MqttPublishPacket ) mqttPacket ;
60
+ return ( MqttPacketWithIdentifier ) mqttPacket ;
61
61
}
62
62
63
63
/// <summary>
@@ -72,7 +72,7 @@ public async Task<MqttPublishPacket> DeliverApplicationMessageAsync(MqttApplicat
72
72
/// However, an existing message in the queue may be <b>dropped later</b> to make room for the newly enqueued message.
73
73
/// Such dropped messages can be tracked by subscribing to <see cref="MqttServer.QueuedApplicationMessageOverwrittenAsync"/> event.
74
74
/// </remarks>
75
- public bool TryEnqueueApplicationMessage ( MqttApplicationMessage applicationMessage , out MqttPublishPacket publishPacket )
75
+ public bool TryEnqueueApplicationMessage ( MqttApplicationMessage applicationMessage , out MqttPacketWithIdentifier publishPacket )
76
76
{
77
77
ArgumentNullException . ThrowIfNull ( applicationMessage ) ;
78
78
Original file line number Diff line number Diff line change 3
3
using Microsoft . VisualStudio . TestTools . UnitTesting ;
4
4
using MQTTnet . Internal ;
5
5
using MQTTnet . Packets ;
6
+ using MQTTnet . Protocol ;
6
7
using MQTTnet . Server ;
7
8
using MQTTnet . Server . Exceptions ;
8
9
@@ -28,7 +29,10 @@ public async Task Enqueue_Application_Message_At_Session_Level()
28
29
await receiver1 . SubscribeAsync ( "#" ) ;
29
30
await receiver2 . SubscribeAsync ( "#" ) ;
30
31
31
- var message = new MqttApplicationMessageBuilder ( ) . WithTopic ( "InjectedOne" ) . Build ( ) ;
32
+ var message = new MqttApplicationMessageBuilder ( )
33
+ . WithQualityOfServiceLevel ( MqttQualityOfServiceLevel . AtLeastOnce )
34
+ . WithTopic ( "InjectedOne" ) . Build ( ) ;
35
+
32
36
var enqueued = clientStatus . TryEnqueueApplicationMessage ( message , out var publishPacket ) ;
33
37
34
38
Assert . IsTrue ( enqueued ) ;
@@ -215,7 +219,10 @@ public async Task Deliver_Application_Message_At_Session_Level()
215
219
await receiver1 . SubscribeAsync ( "#" ) ;
216
220
await receiver2 . SubscribeAsync ( "#" ) ;
217
221
218
- var mqttApplicationMessage = new MqttApplicationMessageBuilder ( ) . WithTopic ( "InjectedOne" ) . Build ( ) ;
222
+ var mqttApplicationMessage = new MqttApplicationMessageBuilder ( )
223
+ . WithTopic ( "InjectedOne" )
224
+ . WithQualityOfServiceLevel ( MqttQualityOfServiceLevel . AtLeastOnce )
225
+ . Build ( ) ;
219
226
var publishPacket = await clientStatus . DeliverApplicationMessageAsync ( mqttApplicationMessage ) ;
220
227
221
228
await LongTestDelay ( ) ;
You can’t perform that action at this time.
0 commit comments