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 00492cc71d69ba03668a4a0e51cfebfc32a89cc9 Author: Aaron Ai <[email protected]> AuthorDate: Mon Mar 6 12:02:13 2023 +0800 Bugfix: wrong message type judgement --- csharp/examples/ProducerDelayMessageExample.cs | 1 + csharp/examples/ProducerNormalMessageExample.cs | 8 ++------ .../examples/ProducerTransactionMessageExample.cs | 4 +++- csharp/rocketmq-client-csharp/ClientManager.cs | 2 +- csharp/rocketmq-client-csharp/PublishingMessage.cs | 2 +- csharp/rocketmq-client-csharp/SimpleConsumer.cs | 3 ++- csharp/rocketmq-client-csharp/logo.png | Bin 83556 -> 85598 bytes 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/csharp/examples/ProducerDelayMessageExample.cs b/csharp/examples/ProducerDelayMessageExample.cs index e2e362c3..f1119245 100644 --- a/csharp/examples/ProducerDelayMessageExample.cs +++ b/csharp/examples/ProducerDelayMessageExample.cs @@ -31,6 +31,7 @@ namespace examples { const string accessKey = "yourAccessKey"; const string secretKey = "yourSecretKey"; + // Credential provider is optional for client configuration. var credentialsProvider = new StaticSessionCredentialsProvider(accessKey, secretKey); const string endpoints = "foobar.com:8080"; diff --git a/csharp/examples/ProducerNormalMessageExample.cs b/csharp/examples/ProducerNormalMessageExample.cs index 7cd3fabb..d1d6fd3d 100644 --- a/csharp/examples/ProducerNormalMessageExample.cs +++ b/csharp/examples/ProducerNormalMessageExample.cs @@ -61,12 +61,8 @@ namespace examples .SetKeys("yourMessageKey-7044358f98fc") .Build(); - for (int i = 0; i < 99999999; i++) - { - var sendReceipt = await producer.Send(message); - Logger.Info($"Send message successfully, sendReceipt={sendReceipt}"); - await Task.Delay(TimeSpan.FromSeconds(1)); - } + var sendReceipt = await producer.Send(message); + Logger.Info($"Send message successfully, sendReceipt={sendReceipt}"); // Or you could close the producer manually. // await producer.DisposeAsync(); diff --git a/csharp/examples/ProducerTransactionMessageExample.cs b/csharp/examples/ProducerTransactionMessageExample.cs index d5c05e5b..f9c34ffa 100644 --- a/csharp/examples/ProducerTransactionMessageExample.cs +++ b/csharp/examples/ProducerTransactionMessageExample.cs @@ -30,6 +30,7 @@ namespace examples { public TransactionResolution Check(MessageView messageView) { + Logger.Info("Receive transaction check, messageId={}", messageView.MessageId); return TransactionResolution.COMMIT; } } @@ -38,6 +39,7 @@ namespace examples { const string accessKey = "yourAccessKey"; const string secretKey = "yourSecretKey"; + // Credential provider is optional for client configuration. var credentialsProvider = new StaticSessionCredentialsProvider(accessKey, secretKey); const string endpoints = "foobar.com:8080"; @@ -74,7 +76,7 @@ namespace examples // Commit the transaction. transaction.Commit(); // Or rollback the transaction. - // transaction.rollback(); + // transaction.Rollback(); // Or you could close the producer manually. // await producer.DisposeAsync(); } diff --git a/csharp/rocketmq-client-csharp/ClientManager.cs b/csharp/rocketmq-client-csharp/ClientManager.cs index 498beef8..9d0b92a5 100644 --- a/csharp/rocketmq-client-csharp/ClientManager.cs +++ b/csharp/rocketmq-client-csharp/ClientManager.cs @@ -20,7 +20,7 @@ using System; using System.Threading; using System.Threading.Tasks; using grpc = Grpc.Core; -using System.Collections.Generic; +using System.Collections.Generic; namespace Org.Apache.Rocketmq { diff --git a/csharp/rocketmq-client-csharp/PublishingMessage.cs b/csharp/rocketmq-client-csharp/PublishingMessage.cs index 369b7270..b5c92f51 100644 --- a/csharp/rocketmq-client-csharp/PublishingMessage.cs +++ b/csharp/rocketmq-client-csharp/PublishingMessage.cs @@ -67,7 +67,7 @@ namespace Org.Apache.Rocketmq } // For TRANSACTION message. - if (string.IsNullOrEmpty(message.MessageGroup) || message.DeliveryTimestamp.HasValue || !txEnabled) + if (!string.IsNullOrEmpty(message.MessageGroup) || message.DeliveryTimestamp.HasValue || !txEnabled) throw new InternalErrorException( "Transactional message should not set messageGroup or deliveryTimestamp"); MessageType = MessageType.Transaction; diff --git a/csharp/rocketmq-client-csharp/SimpleConsumer.cs b/csharp/rocketmq-client-csharp/SimpleConsumer.cs index a9c4713b..017e7665 100644 --- a/csharp/rocketmq-client-csharp/SimpleConsumer.cs +++ b/csharp/rocketmq-client-csharp/SimpleConsumer.cs @@ -137,7 +137,8 @@ namespace Org.Apache.Rocketmq { return new Proto::HeartbeatRequest { - ClientType = Proto.ClientType.SimpleConsumer + ClientType = Proto.ClientType.SimpleConsumer, + Group = GetProtobufGroup() }; } diff --git a/csharp/rocketmq-client-csharp/logo.png b/csharp/rocketmq-client-csharp/logo.png index 9ba4581d..88761dc1 100644 Binary files a/csharp/rocketmq-client-csharp/logo.png and b/csharp/rocketmq-client-csharp/logo.png differ
