@@ -294,11 +294,11 @@ public ValueTask PongAsync(CancellationToken cancellationToken = default)
294294 return default ;
295295 }
296296
297- public ValueTask PublishAsync < T > ( string subject , T ? value , NatsHeaders ? headers , string ? replyTo , INatsSerialize < T > serializer , CancellationToken cancellationToken )
297+ public ValueTask PublishAsync < T > ( NatsPublishProps props , T ? value , NatsHeaders ? headers , INatsSerialize < T > serializer , CancellationToken cancellationToken )
298298 {
299299 if ( _trace )
300300 {
301- _logger . LogTrace ( NatsLogEvents . Protocol , "PUB {Subject} {ReplyTo}" , subject , replyTo ) ;
301+ _logger . LogTrace ( NatsLogEvents . Protocol , "PUB {Subject} {ReplyTo}" , props . Subject , props . ReplyTo ) ;
302302 }
303303
304304 NatsPooledBufferWriter < byte > ? headersBuffer = null ;
@@ -346,12 +346,12 @@ public ValueTask PublishAsync<T>(string subject, T? value, NatsHeaders? headers,
346346#pragma warning restore VSTHRD103
347347#pragma warning restore CA2016
348348 {
349- return PublishStateMachineAsync ( false , subject , replyTo , headersBuffer , payloadBuffer , cancellationToken ) ;
349+ return PublishStateMachineAsync ( false , props , headersBuffer , payloadBuffer , cancellationToken ) ;
350350 }
351351
352352 if ( _flushTask . IsNotCompletedSuccessfully ( ) )
353353 {
354- return PublishStateMachineAsync ( true , subject , replyTo , headersBuffer , payloadBuffer , cancellationToken ) ;
354+ return PublishStateMachineAsync ( true , props , headersBuffer , payloadBuffer , cancellationToken ) ;
355355 }
356356
357357 try
@@ -361,7 +361,7 @@ public ValueTask PublishAsync<T>(string subject, T? value, NatsHeaders? headers,
361361 throw new ObjectDisposedException ( nameof ( CommandWriter ) ) ;
362362 }
363363
364- _protocolWriter . WritePublish ( _pipeWriter , subject , replyTo , headersBuffer ? . WrittenMemory , payloadBuffer . WrittenMemory ) ;
364+ _protocolWriter . WritePublish ( _pipeWriter , props , headersBuffer ? . WrittenMemory , payloadBuffer . WrittenMemory ) ;
365365 EnqueueCommand ( ) ;
366366 }
367367 finally
@@ -381,11 +381,11 @@ public ValueTask PublishAsync<T>(string subject, T? value, NatsHeaders? headers,
381381 return default ;
382382 }
383383
384- public ValueTask SubscribeAsync ( int sid , string subject , string ? queueGroup , int ? maxMsgs , CancellationToken cancellationToken )
384+ public ValueTask SubscribeAsync ( NatsSubscriptionProps props , int ? maxMsgs , CancellationToken cancellationToken )
385385 {
386386 if ( _trace )
387387 {
388- _logger . LogTrace ( NatsLogEvents . Protocol , "SUB {Subject} {QueueGroup} {MaxMsgs}" , subject , queueGroup , maxMsgs ) ;
388+ _logger . LogTrace ( NatsLogEvents . Protocol , "SUB {Subject} {QueueGroup} {MaxMsgs}" , props . Subject , props . QueueGroup , maxMsgs ) ;
389389 }
390390
391391#pragma warning disable CA2016
@@ -394,12 +394,12 @@ public ValueTask SubscribeAsync(int sid, string subject, string? queueGroup, int
394394#pragma warning restore VSTHRD103
395395#pragma warning restore CA2016
396396 {
397- return SubscribeStateMachineAsync ( false , sid , subject , queueGroup , maxMsgs , cancellationToken ) ;
397+ return SubscribeStateMachineAsync ( false , props , maxMsgs , cancellationToken ) ;
398398 }
399399
400400 if ( _flushTask . IsNotCompletedSuccessfully ( ) )
401401 {
402- return SubscribeStateMachineAsync ( true , sid , subject , queueGroup , maxMsgs , cancellationToken ) ;
402+ return SubscribeStateMachineAsync ( true , props , maxMsgs , cancellationToken ) ;
403403 }
404404
405405 try
@@ -409,7 +409,7 @@ public ValueTask SubscribeAsync(int sid, string subject, string? queueGroup, int
409409 throw new ObjectDisposedException ( nameof ( CommandWriter ) ) ;
410410 }
411411
412- _protocolWriter . WriteSubscribe ( _pipeWriter , sid , subject , queueGroup , maxMsgs ) ;
412+ _protocolWriter . WriteSubscribe ( _pipeWriter , props , maxMsgs ) ;
413413 EnqueueCommand ( ) ;
414414 }
415415 finally
@@ -420,11 +420,11 @@ public ValueTask SubscribeAsync(int sid, string subject, string? queueGroup, int
420420 return default ;
421421 }
422422
423- public ValueTask UnsubscribeAsync ( int sid , int ? maxMsgs , CancellationToken cancellationToken )
423+ public ValueTask UnsubscribeAsync ( NatsSubscriptionProps props , int ? maxMsgs , CancellationToken cancellationToken )
424424 {
425425 if ( _trace )
426426 {
427- _logger . LogTrace ( NatsLogEvents . Protocol , "UNSUB {Sid} {MaxMsgs}" , sid , maxMsgs ) ;
427+ _logger . LogTrace ( NatsLogEvents . Protocol , "UNSUB {Sid} {MaxMsgs}" , props . SubscriptionId , maxMsgs ) ;
428428 }
429429
430430#pragma warning disable CA2016
@@ -433,12 +433,12 @@ public ValueTask UnsubscribeAsync(int sid, int? maxMsgs, CancellationToken cance
433433#pragma warning restore VSTHRD103
434434#pragma warning restore CA2016
435435 {
436- return UnsubscribeStateMachineAsync ( false , sid , maxMsgs , cancellationToken ) ;
436+ return UnsubscribeStateMachineAsync ( false , props , maxMsgs , cancellationToken ) ;
437437 }
438438
439439 if ( _flushTask . IsNotCompletedSuccessfully ( ) )
440440 {
441- return UnsubscribeStateMachineAsync ( true , sid , maxMsgs , cancellationToken ) ;
441+ return UnsubscribeStateMachineAsync ( true , props , maxMsgs , cancellationToken ) ;
442442 }
443443
444444 try
@@ -448,7 +448,7 @@ public ValueTask UnsubscribeAsync(int sid, int? maxMsgs, CancellationToken cance
448448 throw new ObjectDisposedException ( nameof ( CommandWriter ) ) ;
449449 }
450450
451- _protocolWriter . WriteUnsubscribe ( _pipeWriter , sid , maxMsgs ) ;
451+ _protocolWriter . WriteUnsubscribe ( _pipeWriter , props , maxMsgs ) ;
452452 EnqueueCommand ( ) ;
453453 }
454454 finally
@@ -815,7 +815,7 @@ private async ValueTask PongStateMachineAsync(bool lockHeld, CancellationToken c
815815#if ! NETSTANDARD
816816 [ AsyncMethodBuilder ( typeof ( PoolingAsyncValueTaskMethodBuilder ) ) ]
817817#endif
818- private async ValueTask PublishStateMachineAsync ( bool lockHeld , string subject , string ? replyTo , NatsPooledBufferWriter < byte > ? headersBuffer , NatsPooledBufferWriter < byte > payloadBuffer , CancellationToken cancellationToken )
818+ private async ValueTask PublishStateMachineAsync ( bool lockHeld , NatsPublishProps props , NatsPooledBufferWriter < byte > ? headersBuffer , NatsPooledBufferWriter < byte > payloadBuffer , CancellationToken cancellationToken )
819819 {
820820 try
821821 {
@@ -839,7 +839,7 @@ private async ValueTask PublishStateMachineAsync(bool lockHeld, string subject,
839839 await _flushTask ! . WaitAsync ( _defaultCommandTimeout , cancellationToken ) . ConfigureAwait ( false ) ;
840840 }
841841
842- _protocolWriter . WritePublish ( _pipeWriter , subject , replyTo , headersBuffer ? . WrittenMemory , payloadBuffer . WrittenMemory ) ;
842+ _protocolWriter . WritePublish ( _pipeWriter , props , headersBuffer ? . WrittenMemory , payloadBuffer . WrittenMemory ) ;
843843 EnqueueCommand ( ) ;
844844 }
845845 catch ( TimeoutException )
@@ -866,7 +866,7 @@ private async ValueTask PublishStateMachineAsync(bool lockHeld, string subject,
866866 }
867867 }
868868
869- private async ValueTask SubscribeStateMachineAsync ( bool lockHeld , int sid , string subject , string ? queueGroup , int ? maxMsgs , CancellationToken cancellationToken )
869+ private async ValueTask SubscribeStateMachineAsync ( bool lockHeld , NatsSubscriptionProps props , int ? maxMsgs , CancellationToken cancellationToken )
870870 {
871871 if ( ! lockHeld )
872872 {
@@ -888,7 +888,7 @@ private async ValueTask SubscribeStateMachineAsync(bool lockHeld, int sid, strin
888888 await _flushTask ! . WaitAsync ( _defaultCommandTimeout , cancellationToken ) . ConfigureAwait ( false ) ;
889889 }
890890
891- _protocolWriter . WriteSubscribe ( _pipeWriter , sid , subject , queueGroup , maxMsgs ) ;
891+ _protocolWriter . WriteSubscribe ( _pipeWriter , props , maxMsgs ) ;
892892 EnqueueCommand ( ) ;
893893 }
894894 catch ( TimeoutException )
@@ -903,7 +903,7 @@ private async ValueTask SubscribeStateMachineAsync(bool lockHeld, int sid, strin
903903 }
904904 }
905905
906- private async ValueTask UnsubscribeStateMachineAsync ( bool lockHeld , int sid , int ? maxMsgs , CancellationToken cancellationToken )
906+ private async ValueTask UnsubscribeStateMachineAsync ( bool lockHeld , NatsSubscriptionProps props , int ? maxMsgs , CancellationToken cancellationToken )
907907 {
908908 if ( ! lockHeld )
909909 {
@@ -925,7 +925,7 @@ private async ValueTask UnsubscribeStateMachineAsync(bool lockHeld, int sid, int
925925 await _flushTask ! . WaitAsync ( _defaultCommandTimeout , cancellationToken ) . ConfigureAwait ( false ) ;
926926 }
927927
928- _protocolWriter . WriteUnsubscribe ( _pipeWriter , sid , maxMsgs ) ;
928+ _protocolWriter . WriteUnsubscribe ( _pipeWriter , props , maxMsgs ) ;
929929 EnqueueCommand ( ) ;
930930 }
931931 catch ( TimeoutException )
0 commit comments