You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by aa...@apache.org on 2022/12/27 14:05:14 UTC

[rocketmq-clients] 03/03: dotnet: allow changing SimpleConsumer polling time

This is an automated email from the ASF dual-hosted git repository.

aaronai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-clients.git

commit 12ef82697b098ad61a7c17da1fdd3db020c808a6
Author: colprog <co...@gmail.com>
AuthorDate: Sun Dec 25 04:06:46 2022 +0800

    dotnet: allow changing SimpleConsumer polling time
---
 csharp/rocketmq-client-csharp/SimpleConsumer.cs | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/csharp/rocketmq-client-csharp/SimpleConsumer.cs b/csharp/rocketmq-client-csharp/SimpleConsumer.cs
index 5dd3a03b..ff92044f 100644
--- a/csharp/rocketmq-client-csharp/SimpleConsumer.cs
+++ b/csharp/rocketmq-client-csharp/SimpleConsumer.cs
@@ -196,7 +196,7 @@ namespace Org.Apache.Rocketmq
             }
         }
 
-        public async Task<List<Message>> Receive(int batchSize, TimeSpan invisibleDuration)
+        public async Task<List<Message>> Receive(int batchSize, TimeSpan invisibleDuration, TimeSpan? awaitDuration = null)
         {
             var messageQueue = NextQueue();
             if (null == messageQueue)
@@ -225,8 +225,7 @@ namespace Org.Apache.Rocketmq
             var metadata = new Metadata();
             Signature.Sign(this, metadata);
 
-            var timeout = ClientSettings.Subscription.LongPollingTimeout
-                .ToTimeSpan()
+            var timeout = (awaitDuration ?? ClientSettings.Subscription.LongPollingTimeout.ToTimeSpan())
                 .Add(this.RequestTimeout);
 
             return await Manager.ReceiveMessage(targetUrl, metadata, request, timeout);