velviagris opened a new issue, #1048:
URL: https://github.com/apache/rocketmq-clients/issues/1048

   ### Before Creating the Bug Report
   
   - [x] I found a bug, not just asking a question, which should be created in 
[GitHub Discussions](https://github.com/apache/rocketmq-clients/discussions).
   
   - [x] I have searched the [GitHub 
Issues](https://github.com/apache/rocketmq-clients/issues) and [GitHub 
Discussions](https://github.com/apache/rocketmq-clients/discussions)  of this 
repository and believe that this is not a duplicate.
   
   - [x] I have confirmed that this bug belongs to the current repository, not 
other repositories of RocketMQ.
   
   
   ### Programming Language of the Client
   
   C#
   
   ### Runtime Platform Environment
   
   Windows 11, Kylin v10
   
   ### RocketMQ Version of the Client/Server
   
   RocketMQ.Client v5.1.0
   
   RocketMQ Server v5
   
   ### Run or Compiler Version
   
   .NET8
   
   ### Describe the Bug
   
   Enable Ssl in clientConfig, it doesn't work:
   
   ```csharp
                           var subscription = new Dictionary<string, 
FilterExpression>
                               { { topic, new FilterExpression("*") } };
                           var simpleConsumerBuilder = new 
SimpleConsumer.Builder()
                               .SetConsumerGroup(consumerGroup)
                               .SetAwaitDuration(TimeSpan.FromSeconds(15))
                               .SetSubscriptionExpression(subscription);
                           var clientConfigBuilder = new ClientConfig.Builder()
                               .SetEndpoints(endpoints)
                               .EnableSsl(true)
                               ;
                           if (!string.IsNullOrEmpty(accessKey) && 
!string.IsNullOrEmpty(secretKey))
                           {
                               var credentialsProvider = new 
StaticSessionCredentialsProvider(accessKey, secretKey);
                               clientConfigBuilder
                                   .SetCredentialsProvider(credentialsProvider);
                           }
                           
                           var clientConfig = clientConfigBuilder.Build();
                           simpleConsumerBuilder.SetClientConfig(clientConfig);
                           
                           var simpleConsumer = await 
simpleConsumerBuilder.Build();
   ```
   
   Throws an error:
   
   ```
   Status(StatusCode="Internal", Detail="Error starting gRPC call. 
HttpRequestException: Requesting HTTP version 2.0 with version policy 
RequestVersionOrHigher while unable to establish HTTP/2 connection.", 
DebugException="System.Net.Http.HttpRequestException: Requesting HTTP version 
2.0 with version policy RequestVersionOrHigher while unable to establish HTTP/2 
connection.")
   ```
   
   And I ran the pushConsumer example of Java client, it works:
   
   ```java
   public class PushConsumer {
   
       public static void main(String[] args) throws InterruptedException, 
MQClientException {
   
           RPCHook rpcHook = new AclClientRPCHook(new SessionCredentials("", 
""));
   
           DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(null, "", 
rpcHook);
           consumer.setNamesrvAddr("");
           consumer.setUseTLS(true);
           consumer.subscribe("", "*");
           consumer.registerMessageListener(new MessageListenerConcurrently() {
               @Override
               public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> 
msgs, ConsumeConcurrentlyContext context) {
                   System.out.printf("%s Receive New Messages: %s %n", 
Thread.currentThread().getName(), msgs);
                   return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
               }
           });
           consumer.start();
           System.out.printf("Consumer Started.%n");
       }
   }
   ```
   
   ### Steps to Reproduce
   
   Enable ACL on RocketMQ server and run 
[example](https://github.com/apache/rocketmq-clients/blob/master/csharp/examples/SimpleConsumerExample.cs)
 with `EnableSsl(true)`
   
   ### What Did You Expect to See?
   
   To make simpleConsumer successfully initialized and start to receive data 
from topic.
   
   ### What Did You See Instead?
   
   The consumer initialized failed and throws an exception:
   
   ```
   Status(StatusCode="Internal", Detail="Error starting gRPC call. 
HttpRequestException: Requesting HTTP version 2.0 with version policy 
RequestVersionOrHigher while unable to establish HTTP/2 connection.", 
DebugException="System.Net.Http.HttpRequestException: Requesting HTTP version 
2.0 with version policy RequestVersionOrHigher while unable to establish HTTP/2 
connection.")
   ```
   
   ### Additional Context
   
   _No response_


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to