You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by GitBox <gi...@apache.org> on 2021/07/26 17:09:13 UTC

[GitHub] [activemq-nms-amqp] michaelandrepearce commented on a change in pull request #70: Amqnet 723

michaelandrepearce commented on a change in pull request #70:
URL: https://github.com/apache/activemq-nms-amqp/pull/70#discussion_r676791016



##########
File path: src/NMS.AMQP/Provider/Amqp/AmqpProducer.cs
##########
@@ -162,55 +160,68 @@ private void SendSync(global::Amqp.Message message, DeliveryState deliveryState)
         {
             senderLink.Send(message, deliveryState, null, null);
         }
-        
+
         private async Task SendAsync(global::Amqp.Message message, DeliveryState deliveryState)
         {
-            var tcs = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
-            CancellationTokenSource cts = null;
-            if (session.Connection.Provider.SendTimeout != NmsConnectionInfo.INFINITE)
+            CheckMaxMessageSize(message);
+
+            Outcome outcome = null;
+            try
             {
-                cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(session.Connection.Provider.SendTimeout));
-                cts.Token.Register(_ =>
-                {
-                    var timeoutException = ExceptionSupport.GetTimeoutException(this.senderLink, $"The operation did not complete within the allocated time {session.Connection.Provider.SendTimeout}ms.");
-                    tcs.TrySetException(timeoutException);
-                }, null);
+                outcome = await senderLink.SendAsync(message, deliveryState, session.Connection.Provider.SendTimeout).Await(); 
+                // NmsConnectionInfo.INFINITE is -1 which is the same as System.Threading.Timeout.Infinite that should have meaning of not start the internal timer in AmqpSendTask

Review comment:
       Can we use the connection info still




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org