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 9f98c85dabb4ce1e4a0dc48e06c80560a805e9cc
Author: Aaron Ai <[email protected]>
AuthorDate: Wed Mar 8 19:19:46 2023 +0800

    Delete useless code
---
 csharp/examples/ProducerNormalMessageExample.cs |  3 +-
 csharp/rocketmq-client-csharp/Client.cs         |  8 +--
 csharp/rocketmq-client-csharp/ClientConfig.cs   |  2 +-
 csharp/rocketmq-client-csharp/ClientManager.cs  | 13 ++--
 csharp/rocketmq-client-csharp/IClientConfig.cs  | 30 ---------
 csharp/rocketmq-client-csharp/IRpcClient.cs     |  7 ++-
 csharp/rocketmq-client-csharp/Resource.cs       |  1 -
 csharp/rocketmq-client-csharp/RpcClient.cs      | 15 ++---
 csharp/rocketmq-client-csharp/Topic.cs          | 84 -------------------------
 9 files changed, 17 insertions(+), 146 deletions(-)

diff --git a/csharp/examples/ProducerNormalMessageExample.cs 
b/csharp/examples/ProducerNormalMessageExample.cs
index d1d6fd3d..b9b85b73 100644
--- a/csharp/examples/ProducerNormalMessageExample.cs
+++ b/csharp/examples/ProducerNormalMessageExample.cs
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 
-using System;
 using System.Text;
 using System.Threading.Tasks;
 using NLog;
@@ -62,7 +61,7 @@ namespace examples
                 .Build();
 
             var sendReceipt = await producer.Send(message);
-            Logger.Info($"Send message successfully, 
sendReceipt={sendReceipt}");
+            Logger.Info($"Send message successfully, 
messageId={sendReceipt.MessageId}");
 
             // Or you could close the producer manually.
             // await producer.DisposeAsync();
diff --git a/csharp/rocketmq-client-csharp/Client.cs 
b/csharp/rocketmq-client-csharp/Client.cs
index c5d03286..0249b89a 100644
--- a/csharp/rocketmq-client-csharp/Client.cs
+++ b/csharp/rocketmq-client-csharp/Client.cs
@@ -92,8 +92,7 @@ namespace Org.Apache.Rocketmq
             }
 
             ScheduleWithFixedDelay(UpdateTopicRouteCache, 
TopicRouteUpdateScheduleDelay,
-                TopicRouteUpdateSchedulePeriod,
-                _topicRouteUpdateCts.Token);
+                TopicRouteUpdateSchedulePeriod, _topicRouteUpdateCts.Token);
             ScheduleWithFixedDelay(Heartbeat, HeartbeatScheduleDelay, 
HeartbeatSchedulePeriod, _heartbeatCts.Token);
             ScheduleWithFixedDelay(SyncSettings, SettingsSyncScheduleDelay, 
SettingsSyncSchedulePeriod,
                 _settingsSyncCts.Token);
@@ -154,10 +153,8 @@ namespace Org.Apache.Rocketmq
 
         protected abstract Proto::HeartbeatRequest WrapHeartbeatRequest();
 
-
         protected abstract void OnTopicRouteDataUpdated0(string topic, 
TopicRouteData topicRouteData);
 
-
         private async Task OnTopicRouteDataFetched(string topic, 
TopicRouteData topicRouteData)
         {
             var routeEndpoints = new HashSet<Endpoints>();
@@ -392,8 +389,7 @@ namespace Org.Apache.Rocketmq
                 Logger.Error(e, $"[Bug] unexpected exception raised during 
heartbeat, clientId={ClientId}");
             }
         }
-
-
+        
         internal grpc.Metadata Sign()
         {
             var metadata = new grpc::Metadata();
diff --git a/csharp/rocketmq-client-csharp/ClientConfig.cs 
b/csharp/rocketmq-client-csharp/ClientConfig.cs
index 609ad1d7..f6c219af 100644
--- a/csharp/rocketmq-client-csharp/ClientConfig.cs
+++ b/csharp/rocketmq-client-csharp/ClientConfig.cs
@@ -19,7 +19,7 @@ using System;
 
 namespace Org.Apache.Rocketmq
 {
-    public class ClientConfig : IClientConfig
+    public class ClientConfig
     {
         private ClientConfig(ISessionCredentialsProvider 
sessionCredentialsProvider, TimeSpan requestTimeout,
             string endpoints, bool sslEnabled)
diff --git a/csharp/rocketmq-client-csharp/ClientManager.cs 
b/csharp/rocketmq-client-csharp/ClientManager.cs
index 808d73f1..90fdde7f 100644
--- a/csharp/rocketmq-client-csharp/ClientManager.cs
+++ b/csharp/rocketmq-client-csharp/ClientManager.cs
@@ -21,6 +21,7 @@ using System.Threading;
 using System.Threading.Tasks;
 using grpc = Grpc.Core;
 using System.Collections.Generic;
+using System.Linq;
 
 namespace Org.Apache.Rocketmq
 {
@@ -78,11 +79,7 @@ namespace Org.Apache.Rocketmq
             _clientLock.EnterReadLock();
             try
             {
-                var tasks = new List<Task>();
-                foreach (var item in _rpcClients)
-                {
-                    tasks.Add(item.Value.Shutdown());
-                }
+                var tasks = _rpcClients.Select(item => 
item.Value.Shutdown()).ToList();
 
                 await Task.WhenAll(tasks);
             }
@@ -99,8 +96,7 @@ namespace Org.Apache.Rocketmq
         }
 
         public async Task<RpcInvocation<Proto.QueryRouteRequest, 
Proto.QueryRouteResponse>> QueryRoute(
-            Endpoints endpoints,
-            Proto.QueryRouteRequest request, TimeSpan timeout)
+            Endpoints endpoints, Proto.QueryRouteRequest request, TimeSpan 
timeout)
         {
             var metadata = _client.Sign();
             var response = await GetRpcClient(endpoints).QueryRoute(metadata, 
request, timeout);
@@ -171,8 +167,7 @@ namespace Org.Apache.Rocketmq
         }
 
         public async Task<RpcInvocation<Proto.EndTransactionRequest, 
Proto.EndTransactionResponse>> EndTransaction(
-            Endpoints endpoints,
-            Proto.EndTransactionRequest request, TimeSpan timeout)
+            Endpoints endpoints, Proto.EndTransactionRequest request, TimeSpan 
timeout)
         {
             var metadata = _client.Sign();
             var response = await 
GetRpcClient(endpoints).EndTransaction(metadata, request, timeout);
diff --git a/csharp/rocketmq-client-csharp/IClientConfig.cs 
b/csharp/rocketmq-client-csharp/IClientConfig.cs
deleted file mode 100644
index d11c2b2d..00000000
--- a/csharp/rocketmq-client-csharp/IClientConfig.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-using System;
-
-namespace Org.Apache.Rocketmq
-{
-    public interface IClientConfig
-    {
-        ISessionCredentialsProvider SessionCredentialsProvider { get; }
-
-        TimeSpan RequestTimeout { get; }
-
-        string Endpoints { get; }
-    }
-}
\ No newline at end of file
diff --git a/csharp/rocketmq-client-csharp/IRpcClient.cs 
b/csharp/rocketmq-client-csharp/IRpcClient.cs
index 146d4f7c..8145ea18 100644
--- a/csharp/rocketmq-client-csharp/IRpcClient.cs
+++ b/csharp/rocketmq-client-csharp/IRpcClient.cs
@@ -36,18 +36,19 @@ namespace Org.Apache.Rocketmq
         Task<QueryAssignmentResponse> QueryAssignment(Metadata metadata, 
QueryAssignmentRequest request,
             TimeSpan timeout);
 
-        Task<List<ReceiveMessageResponse>> ReceiveMessage(Metadata metadata, 
ReceiveMessageRequest request, TimeSpan timeout);
+        Task<List<ReceiveMessageResponse>> ReceiveMessage(Metadata metadata, 
ReceiveMessageRequest request,
+            TimeSpan timeout);
 
         Task<AckMessageResponse> AckMessage(Metadata metadata, 
AckMessageRequest request, TimeSpan timeout);
 
-        Task<ChangeInvisibleDurationResponse> ChangeInvisibleDuration(Metadata 
metadata, ChangeInvisibleDurationRequest request, TimeSpan timeout);
+        Task<ChangeInvisibleDurationResponse> ChangeInvisibleDuration(Metadata 
metadata,
+            ChangeInvisibleDurationRequest request, TimeSpan timeout);
 
         Task<ForwardMessageToDeadLetterQueueResponse> 
ForwardMessageToDeadLetterQueue(Metadata metadata,
             ForwardMessageToDeadLetterQueueRequest request, TimeSpan timeout);
 
         Task<EndTransactionResponse> EndTransaction(Metadata metadata, 
EndTransactionRequest request, TimeSpan timeout);
 
-
         Task<NotifyClientTerminationResponse> NotifyClientTermination(Metadata 
metadata,
             NotifyClientTerminationRequest request, TimeSpan timeout);
 
diff --git a/csharp/rocketmq-client-csharp/Resource.cs 
b/csharp/rocketmq-client-csharp/Resource.cs
index 5d339475..a0f27df5 100644
--- a/csharp/rocketmq-client-csharp/Resource.cs
+++ b/csharp/rocketmq-client-csharp/Resource.cs
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 
-using System;
 using Proto = Apache.Rocketmq.V2;
 
 namespace Org.Apache.Rocketmq
diff --git a/csharp/rocketmq-client-csharp/RpcClient.cs 
b/csharp/rocketmq-client-csharp/RpcClient.cs
index e4c230b2..abf70563 100644
--- a/csharp/rocketmq-client-csharp/RpcClient.cs
+++ b/csharp/rocketmq-client-csharp/RpcClient.cs
@@ -41,7 +41,7 @@ namespace Org.Apache.Rocketmq
             _target = endpoints.GrpcTarget(sslEnabled);
             _channel = GrpcChannel.ForAddress(_target, new GrpcChannelOptions
             {
-                HttpHandler = CreateHttpHandler()
+                HttpHandler = CreateHttpHandler(),
             });
             var invoker = _channel.Intercept(new ClientLoggerInterceptor());
             _stub = new 
Proto::MessagingService.MessagingServiceClient(invoker);
@@ -93,7 +93,6 @@ namespace Org.Apache.Rocketmq
             return await call.ResponseAsync;
         }
 
-
         public async Task<Proto::HeartbeatResponse> Heartbeat(Metadata 
metadata, Proto::HeartbeatRequest request,
             TimeSpan timeout)
         {
@@ -115,8 +114,7 @@ namespace Org.Apache.Rocketmq
         }
 
         public async Task<Proto::QueryAssignmentResponse> 
QueryAssignment(Metadata metadata,
-            Proto::QueryAssignmentRequest request,
-            TimeSpan timeout)
+            Proto::QueryAssignmentRequest request, TimeSpan timeout)
         {
             var deadline = DateTime.UtcNow.Add(timeout);
             var callOptions = new CallOptions(metadata, deadline);
@@ -156,8 +154,7 @@ namespace Org.Apache.Rocketmq
         }
 
         public async Task<Proto::ChangeInvisibleDurationResponse> 
ChangeInvisibleDuration(Metadata metadata,
-            Proto::ChangeInvisibleDurationRequest request,
-            TimeSpan timeout)
+            Proto::ChangeInvisibleDurationRequest request, TimeSpan timeout)
         {
             var deadline = DateTime.UtcNow.Add(timeout);
             var callOptions = new CallOptions(metadata, deadline);
@@ -167,8 +164,7 @@ namespace Org.Apache.Rocketmq
         }
 
         public async Task<Proto::ForwardMessageToDeadLetterQueueResponse> 
ForwardMessageToDeadLetterQueue(
-            Metadata metadata,
-            Proto::ForwardMessageToDeadLetterQueueRequest request, TimeSpan 
timeout)
+            Metadata metadata, Proto::ForwardMessageToDeadLetterQueueRequest 
request, TimeSpan timeout)
         {
             var deadline = DateTime.UtcNow.Add(timeout);
             var callOptions = new CallOptions(metadata, deadline);
@@ -178,8 +174,7 @@ namespace Org.Apache.Rocketmq
         }
 
         public async Task<Proto::EndTransactionResponse> 
EndTransaction(Metadata metadata,
-            Proto::EndTransactionRequest request,
-            TimeSpan timeout)
+            Proto::EndTransactionRequest request, TimeSpan timeout)
         {
             var deadline = DateTime.UtcNow.Add(timeout);
             var callOptions = new CallOptions(metadata, deadline);
diff --git a/csharp/rocketmq-client-csharp/Topic.cs 
b/csharp/rocketmq-client-csharp/Topic.cs
deleted file mode 100644
index ff66b719..00000000
--- a/csharp/rocketmq-client-csharp/Topic.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-using System;
-
-namespace Org.Apache.Rocketmq
-{
-    public class Topic : IComparable<Topic>, IEquatable<Topic>
-    {
-        public Topic(string resourceNamespace, string name)
-        {
-            ResourceNamespace = resourceNamespace;
-            Name = name;
-        }
-
-        private string ResourceNamespace { get; }
-        private string Name { get; }
-
-        public bool Equals(Topic other)
-        {
-            if (ReferenceEquals(null, other))
-            {
-                return false;
-            }
-
-            if (ReferenceEquals(this, other))
-            {
-                return true;
-            }
-
-            return ResourceNamespace == other.ResourceNamespace && Name == 
other.Name;
-        }
-
-        public override bool Equals(object obj)
-        {
-            if (ReferenceEquals(null, obj) || obj.GetType() != GetType())
-            {
-                return false;
-            }
-
-            if (ReferenceEquals(this, obj))
-            {
-                return true;
-            }
-
-            return Equals((Topic)obj);
-        }
-
-        public override int GetHashCode()
-        {
-            return HashCode.Combine(ResourceNamespace, Name);
-        }
-
-        public int CompareTo(Topic other)
-        {
-            if (ReferenceEquals(null, other))
-            {
-                return -1;
-            }
-
-            var compareTo = String.CompareOrdinal(ResourceNamespace, 
other.ResourceNamespace);
-            if (0 == compareTo)
-            {
-                compareTo = String.CompareOrdinal(Name, other.Name);
-            }
-
-            return compareTo;
-        }
-    }
-}
\ No newline at end of file

Reply via email to