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 2023/03/15 08:02:06 UTC

[rocketmq-clients] branch master updated: Set exception for producer ahead of throwing it

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


The following commit(s) were added to refs/heads/master by this push:
     new 5fa06815 Set exception for producer ahead of throwing it
5fa06815 is described below

commit 5fa0681596d901d556f9092c17ecb23b883cbaee
Author: Aaron Ai <ya...@gmail.com>
AuthorDate: Wed Mar 15 15:42:33 2023 +0800

    Set exception for producer ahead of throwing it
---
 csharp/rocketmq-client-csharp/Producer.cs |   8 ++------
 diff_sec.zip                              | Bin 174 -> 0 bytes
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/csharp/rocketmq-client-csharp/Producer.cs b/csharp/rocketmq-client-csharp/Producer.cs
index 392c50d4..a1f70989 100644
--- a/csharp/rocketmq-client-csharp/Producer.cs
+++ b/csharp/rocketmq-client-csharp/Producer.cs
@@ -157,11 +157,6 @@ namespace Org.Apache.Rocketmq
             var publishingMessage = new PublishingMessage(message, PublishingSettings, txEnabled);
             var retryPolicy = GetRetryPolicy();
             var maxAttempts = retryPolicy.GetMaxAttempts();
-            if (MessageType.Transaction == publishingMessage.MessageType)
-            {
-                // No more retries for transactional message.
-                maxAttempts = 1;
-            }
 
             // Prepare the candidate message queue(s) for retry-sending in advance.
             var candidates = null == publishingMessage.MessageGroup
@@ -244,6 +239,8 @@ namespace Org.Apache.Rocketmq
                 }
                 catch (Exception e)
                 {
+                    exception = e;
+
                     // Isolate current endpoints.
                     Isolated[endpoints] = true;
                     if (attempt >= maxAttempts)
@@ -262,7 +259,6 @@ namespace Org.Apache.Rocketmq
                         throw;
                     }
 
-                    exception = e;
                     if (exception is not TooManyRequestsException)
                     {
                         // Retry immediately if the request is not throttled.
diff --git a/diff_sec.zip b/diff_sec.zip
deleted file mode 100644
index 89278e56..00000000
Binary files a/diff_sec.zip and /dev/null differ